本文介绍了Nginx 反向代理(proxy_pass)不通过子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在像

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/;
   }

使用此配置,我将被传递到正确的应用程序,但该应用程序无法识别子文件夹.它尝试服务器

With this configuration I'll get passed to the correct application but the application does not recognize the subfolder. It tries to server

https://www.example.com/static/style.csshttps://www.example.com/mattermost/style.css 并提出404 错误.

https://www.example.com/static/style.css instead of https://www.example.com/mattermost/style.css and brings up a 404 error.

如何使用 nginx 将子文件夹也传递给反向代理?

How can I pass also the subfolder to the reverse proxy with nginx?

推荐答案

我想要运行的应用程序是Mattermost".正如我现在可以确认的那样,版本

The application I wanted to get running was "Mattermost". As I now can confirm, the use as subfolder is not possible with the Version

Mattermost 团队版版本:3.0.0 (3.0.3)

Mattermost Team Edition Version: 3.0.0 (3.0.3)

更多信息:

http://forum.mattermost.org/t/blank-page-when-installing-mattermost-with-nginx-proxy-pass-as-subdirectory/1604/8

更新:正如上面论坛中所确认的,Mattermost 目前无法配置子文件夹.

Update: As confirmed in the forum above, a subfolder configuration is not possible with Mattermost right now.

这篇关于Nginx 反向代理(proxy_pass)不通过子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:04