Nginx-Reverse-Proxy
Nginx 代理管理器 proxy_pass 不起作用
在 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 。