nginx proxy_pass の設定に問題があります。次のような状況があります。
- サーバー 1 - xx.xx.xx.xx - プロキシ サーバー
- サーバー 2 とアプリケーション A - yy.yy.yy.yy
- サーバー 3 とアプリケーション B - zz.zz.zz.zz
以下にリストされている構成:
server {
listen 80; ## listen for ipv4; this line is default and implied
location /app_a {
rewrite /app_a/(.*)$ /$1 break;
access_log off;
proxy_pass http://yy.yy.yy.yy/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Upstream $remote_addr;
}
location /app_b {
rewrite /app_b/(.*)$ /$1 break;
access_log off;
proxy_pass http://zz.zz.zz.zz;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Upstream $remote_addr;
}
}
次に、ブラウザ xx.xx.xx.xx/app_a または xx.xx.xx.xx/app_b を使用すると、読み込まれた静的ファイルはなく (404)、すべてのリンクにはアプリケーション プレフィックスがありません (xx.xx.xx.xx) /ログインする)
リンクが次のように表示されるようにnginxを構成する方法:
- xx.xx.xx.xx/app_a/ログイン
- xx.xx.xx.xx/app_b/ログイン