在 Nginx 代理管理器上,我有这个配置(名称已编辑)
# ------------------------------------------------------------
# www.lab.myself.it
# ------------------------------------------------------------
server {
set $forward_scheme http;
set $server "127.0.0.1";
set $port 81;
listen 80;
listen [::]:80;
server_name www.lab.myself.it;
access_log /data/logs/proxy-host-2_access.log proxy;
error_log /data/logs/proxy-host-2_error.log warn;
location /wiki/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://maersk.lab.myself.it:8181/;
}
location / {
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}
理想情况下,我应该能够浏览到http://www.lab.myself.it/wiki并且 Nginx 应该将我发送到http://maersk.lab.myself.it:8181。
问题是我得到了一个简单的网页,因为浏览器无法加载 CSS、JS 或图像。当我尝试单击 wiki 上的链接时,它会将我带到http://www.lab.myself.it/documentation <-- MISSING THE /WIKI/
wiki
您需要在应用程序中正确设置基本 URL 。