Nginxのバージョン1.10.2をCentOS 7 OSでホストされているリバースプロキシとして設定したいと思います。同じWildFly 10サーバーで複数のアプリケーションを実行しています。これらのアプリケーションは、http://213.xxx.xxx.xxx/app1
とhttp://213.xxx.xxx.xxx/app2
にあります。 app2 http://app2.example.com
のサブドメインを作成しました。私nginx.conf
ファイルには、それらのサーバーが含まれていますNginxのサブドメインの設定が間違っています
server {
listen 80;
server_name example.com www.example.com;
location/{
proxy_pass http://213.xxx.xxx.xxx/app1;
}
}
server {
listen 80;
server_name app2.example.com www.app2.example.com;
location/{
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://213.xxx.xxx.xxx/app2;
}
}
自分のWebブラウザから、私はURL example.com
でAPP1に到達することができます。しかし、私はapp2に到達することはできません。 app2.example.com
にリクエストを送信すると、app2.example.com/app2
にリダイレクトされます。誰かが私の設定に間違っていることを教えてもらえますか?
「app1.example.com」を使用すると同じことが起こりますか? –
私はapp1のサブドメインを持っていませんが、app3と同じです。 – cheb1k4
私は 'proxy_pass http://213.xxx.xxx.xxx/app1;'を変更することができます。 'app2.example.com'が' app1'を読み込むかどうかを確認してください。 –