我想在子文件夹配置中运行应用程序 Mattermost,例如
https://www.example.com/mattermost/
location /mattermost/ {
gzip off;
proxy_set_header X-Forwarded-Ssl on;
client_max_body_size 50M;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://localhost:8065/;
}
使用此配置,我将被传递到正确的应用程序,但该应用程序无法识别子文件夹。它尝试服务器
https://www.example.com/static/style.css而不是https://www.example.com/mattermost/style.css并引发 404 错误。
如何使用 nginx 将子文件夹也传递给反向代理?