- Oracle APEXの実行環境にnginxによるリバース・プロキシを構成する - Ubuntu 24.04編
- リバース・プロキシとして構成したnginxでWWW-Authenticateヘッダーを書き換える
- ORDSのRESTサービスをClaude Desktopのカスタムコネクタとして登録して呼び出す
コンピュート・インスタンスの準備
リバース・プロキシの構成
ubuntu@ordsmcp2:~$ sh prepare-ubuntu-for-nginx-reverse-proxy.sh
37 packages can be upgraded. Run 'apt list --upgradable' to see them.
The following NEW packages will be installed:
hwdata libnuma1 libpython3.12t64 libslang2 libtraceevent1
linux-headers-6.17.0-1007-oracle linux-image-6.17.0-1007-oracle
linux-modules-6.17.0-1007-oracle linux-modules-extra-6.17.0-1007-oracle
linux-oracle-6.17-headers-6.17.0-1007 linux-oracle-6.17-tools-6.17.0-1007
linux-tools-6.17.0-1007-oracle linux-tools-common wireless-regdb
The following packages will be upgraded:
base-files cloud-init curl fwupd gcc-14-base gir1.2-glib-2.0 initramfs-tools
initramfs-tools-bin initramfs-tools-core libc-bin libc6 libcurl3t64-gnutls
libcurl4t64 libdrm-common libdrm2 libexpat1 libfwupd2 libgcc-s1
libglib2.0-0t64 libgnutls30t64 libldap2 libpng16-16t64 libpython3.12-minimal
libpython3.12-stdlib libssh-4 libssl3t64 libstdc++6 linux-headers-oracle
linux-image-oracle linux-oracle openssl python-apt-common python3-apt
python3-distupgrade python3.12 python3.12-minimal
ubuntu-release-upgrader-core
37 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
23 standard LTS security updates
Need to get 228 MB of archives.
After this operation, 331 MB of additional disk space will be used.
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 48207 files and directories currently installed.)
Preparing to unpack .../gcc-14-base_14.2.0-4ubuntu2~24.04.1_amd64.deb ...
Unpacking gcc-14-base:amd64 (14.2.0-4ubuntu2~24.04.1) over (14.2.0-4ubuntu2~24.04) ...
Setting up gcc-14-base:amd64 (14.2.0-4ubuntu2~24.04.1) ...
(Reading database ... 48207 files and directories currently installed.)
Preparing to unpack .../libgcc-s1_14.2.0-4ubuntu2~24.04.1_amd64.deb ...
Unpacking libgcc-s1:amd64 (14.2.0-4ubuntu2~24.04.1) over (14.2.0-4ubuntu2~24.04) ...
Setting up libgcc-s1:amd64 (14.2.0-4ubuntu2~24.04.1) ...
(Reading database ... 48207 files and directories currently installed.)
Preparing to unpack .../libstdc++6_14.2.0-4ubuntu2~24.04.1_amd64.deb ...
Unpacking libstdc++6:amd64 (14.2.0-4ubuntu2~24.04.1) over (14.2.0-4ubuntu2~24.04) ...
[中略]
Setting up nginx (1.24.0-2ubuntu7.6) ...
* Upgrading binary nginx [ OK ]
Setting up libnginx-mod-http-headers-more-filter (1:0.37-2build1) ...
Setting up python3-acme (2.9.0-1) ...
Setting up python3-certbot (2.9.0-1) ...
Setting up certbot (2.9.0-1) ...
Created symlink /etc/systemd/system/timers.target.wants/certbot.timer → /usr/lib/systemd/system/certbot.timer.
Processing triggers for libc-bin (2.39-0ubuntu8.7) ...
Processing triggers for nginx (1.24.0-2ubuntu7.6) ...
Triggering nginx reload ...
Synchronizing state of nginx.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install disable nginx
Removed "/etc/systemd/system/multi-user.target.wants/nginx.service".
Rules updated
Rules updated (v6)
Rules updated
Rules updated (v6)
Rules updated
Rules updated (v6)
Firewall is active and enabled on system startup
Firewall reloaded
ubuntu@ordsmcp2:~$
sudo shutdown -r now
buntu@ordsmcp2:~$ sudo shutdown -r now
Broadcast message from root@ordsmcp2 on pts/1 (Mon 2026-03-02 02:26:58 UTC):
The system will reboot now!
nginxはホスト名指定でHTTPS接続ができるように構成します。そのため、DNSにホスト名とIPアドレスをあらかじめ登録しておきます。
コンピュート・インスタンスにユーザーubuntuで接続し、rootユーザーに切り替えます。
sudo -s
cd ~
ubuntu@ordsmcp2:~$ sudo -s
root@ordsmcp2:/home/ubuntu# cd ~
root@ordsmcp2:~#
certbot certonly --standalone -d ホスト名
root@ordsmcp2:~# certbot certonly --standalone -d ords.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): メール・アドレス
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.6-August-18-2025.pdf. You must agree
in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Account registered.
Requesting a certificate for ords.example.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/ords.example.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/ords.example.com/privkey.pem
This certificate expires on 2026-05-31.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
root@ordsmcp2:~#
Oracle Linux 10向けに作成した設定ファイルを若干修正します。Oracle Linux 10に含まれるnginxは1.26、Ubuntu 24.04は1.24なので、設定ファイルにサポートされていない構文があります。また、Ubuntuでは設定ファイルを保存するディレクトリ/etc/nginx/default.dを作成します。
mkdir /etc/nginx/default.d
root@ordsmcp2:~# mkdir /etc/nginx/default.d
root@ordsmcp2:~#
以下のnginx.confを/etc/nginx/nginx.confとして配置します。userはnginxからwww-dataに変更します。またモジュールの構成ファイルとして、/usr/share/nginx/modules-available/*.confを参照する様に変更します。
nginx -t
root@ordsmcp2:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@ordsmcp2:~#
nginxの自動起動を有効にし、実行します。
root@ordsmcp2:~# systemctl enable nginx
Synchronizing state of nginx.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
root@ordsmcp2:~# systemctl start nginx
root@ordsmcp2:~#
以上でnginxによるリバース・プロキシの構成は完了です。
テスト用のRESTサービスの作成
https://github.com/ujnak/apexapps/blob/master/exports/chat-with-generative-ai-hc-242.zip
https://github.com/ujnak/apexapps/blob/master/exports/mcp_handler.zip
これらにアプリケーションをインポートすると、リモートMCPサーバーとして呼び出せるツールとRESTサービスが作成されます。
npx @modelcontextprotocol/inspector
sudo vi /etc/nginx/default.d/30-mcp-adb.conf
set $ords_upstream_hostのホスト名の部分を更新します。
ubuntu@ordsmcp2:~$ sudo systemctl restart nginx
ubuntu@ordsmcp2:~$
- Role based JWT profileで保護したORDS REST APIにアクセスする - Microsoft Entra ID編
- Role based JWT profileで保護したORDS REST APIにアクセスする - Okta Integrator編
- Role based JWT profileで保護したORDS REST APIにアクセスする - Auth0編
- Role based JWT profileで保護したORDS REST APIにアクセスする - Oracle IAM編



















