HTTPSを使用してexpressjsウェブサイトにNgInxリバースプロキシを使用しています。ウェブサイトはhttpsで問題なくアクセスされており、リクエストはNodejsサーバーに届いていますが、問題は静的コンテンツにあります。静的コンテンツのNgInx禁止されたエラーnodejs appリバースプロキシ
すべての静的コンテンツ(JS、CSS、画像、フォントなど)は403禁止されたエラーを投げています。私はアマゾンEC2およびCentOSのを使用しています
server {
listen 80;
listen 443 ssl;
ssl on;
ssl_certificate /home/ec2-user/certs/myapp.bundle.crt;
ssl_certificate_key /home/ec2-user/certs/myapp.key;
root /home/ec2-user/myapp;
server_name example.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location/{
#try_files $uri $uri/ /index.php?$args ;
#try_files $uri $uri/ =404;
proxy_pass https://example.com:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
:
以下は私のnginxの設定ファイルの内容です。 助けてください。前もって感謝します。
ノードサーバーまたはngnixで静的コンテンツを提供していますか? – rckrd
私はエクスプレスだけでなくnginxから静的なコンテンツを提供するために両方の方法を試みました。 –