
react (http://localhost:90) と nextjs (my-next-app.com / http://localhost:85) アプリケーション用に 2 つの docker コンテナを実行しており、次のような Nginx 構成になっています。
server {
listen 443 ssl http2;
ssl on;
ssl_certificate /foo.crt;
ssl_certificate_key /foo.key;
server_name www.my-next-app.com my-next-app.com;
location / {
...
proxy_pass http://localhost:85;
}
}
そして私がこれを打った時にやろうとしていたことは詳しくはこちら代わりに、ユーザーには React アプリの FAQ ページ (http://localhost:90/faq) が表示されるようにしたいです。
server {
listen 443 ssl http2;
ssl on;
ssl_certificate /foo.crt;
ssl_certificate_key /foo.key;
server_name www.my-next-app.com my-next-app.com;
location / {
...
proxy_pass http://localhost:85;
}
location /faq {
...
proxy_pass http://localhost:90/faq/;
}
}
上記の設定を試しましたが、うまくいきませんでした。これが実行可能かどうかを知りたいだけです。また、ガイダンスもいただければ幸いです。ブラウザコンソールに次の出力が表示されました。
Uncaught SyntaxError: Unexpected token '<' (at main~eec90089.js:1:1)
答え1
/faq/ の proxy_pass を / の proxy_pass より上に配置してみてください。