http - nginx 反向代理 url 錯誤
問題描述
我在內(nèi)網(wǎng)的機器A上用docker部署了一個jupyter notebook,其ip為10.11.11.10,服務(wù)端口號為8888,機器B可以通過部門二級域名(如child.testgroup.org)訪問其80端口的內(nèi)容。
現(xiàn)在我在,B機的nginx上做反向代理,希望通過child.testgroup.org/notebook來訪問jupyter notebook。我的配置如下:
location /notebook/ {proxy_pass http://10.11.11.10:8888/;proxy_redirect off;proxy_set_header HOST $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';}
但通過child.testgroup.org/notebook來訪問時總是出現(xiàn)url錯誤,如下圖:
jupyter notebook會跳轉(zhuǎn)到/tree這個目錄下,gitlab-ce會跳轉(zhuǎn)到/sign_in,本來希望url是child.testgroup.org/notebook/tree及child.testgroup.org/notebook/sign_in,但跳轉(zhuǎn)時,包括后續(xù)的ajax請求都不會自動加上/notebook/這一段,變成了child.testgroup.org/tree及child.testgroup.org/sign_in。
請大家?guī)兔纯丛趺崔k,是修改nginx配置還是需要其它的要素。
問題解答
回答1:proxy_pass后面加上/notebook/,并且希望child.testgroup.org/notebook可訪問,那location應(yīng)該為/notebook
location /notebook {proxy_pass http://10.11.11.10:8888/notebook/;proxy_redirect off;...}
相關(guān)文章:
1. javascript - 有適合開發(fā)手機端Html5網(wǎng)頁小游戲的前端框架嗎?2. javascript - 關(guān)于apply()與call()的問題3. python 利用subprocess庫調(diào)用mplayer時發(fā)生錯誤4. python - Pycharm的Debug用不了5. python - pandas按照列A和列B分組,將列C求平均數(shù),怎樣才能生成一個列A,B,C的dataframe6. html - eclipse 標簽錯誤7. 安全性測試 - nodejs中如何防m(xù)ySQL注入8. javascript - nginx反向代理靜態(tài)資源403錯誤?9. python - pycharm 自動刪除行尾空格10. python文檔怎么查看?
