主頁(yè) > 知識(shí)庫(kù) > nginx 反向代理之 proxy_pass的實(shí)現(xiàn)

nginx 反向代理之 proxy_pass的實(shí)現(xiàn)

熱門標(biāo)簽:智能電銷機(jī)器人真的有用么 撫州市城區(qū)地圖標(biāo)注 中國(guó)地圖標(biāo)注上各個(gè)省 激光標(biāo)記地圖標(biāo)注 高德地圖標(biāo)注足跡怎么打標(biāo) 企業(yè)辦理400電話收費(fèi)標(biāo)準(zhǔn) 電銷智能機(jī)器人試用 新鄉(xiāng)牧野400電話申請(qǐng) 百度地圖底圖標(biāo)注

格式很簡(jiǎn)單: proxy_pass URL;

其中URL包含:傳輸協(xié)議(http://, https://等)、主機(jī)名(域名或者IP:PORT)、uri。

示例如下:

proxy_pass http://www.xxx.com/;
proxy_pass http://192.168.200.101:8080/uri;
proxy_pass unix:/tmp/www.sock;

對(duì)于proxy_pass的配置有幾種情況需要注意:

假設(shè)server_name為www.xxx.com

當(dāng)請(qǐng)求http://www.xxx.com/aming/a.html的時(shí)候,以上示例分別訪問(wèn)的結(jié)果是

示例1:

location /aming/
{
  proxy_pass http://192.168.1.10;
  ...
}

結(jié)果1:http://192.168.1.10/aming/a.html

示例2:

location /aming/
{
  proxy_pass http://192.168.1.10/;
  ...
}

結(jié)果2:http://192.168.1.10/a.html

示例3:

location /aming/
{
  proxy_pass http://192.168.1.10/linux/;
  ...
}

結(jié)果3:http://192.168.1.10/linux/a.html

示例4:

location /aming/
{
  proxy_pass http://192.168.1.10/linux;
  ...
}

結(jié)果4:http://192.168.1.10/linuxa.html

總結(jié):

為了方便記憶和規(guī)范配置,建議所有的 proxy_pass 后的url都以“/”結(jié)尾。

proxy_pass http://192.168.1.10/linux/;

到此這篇關(guān)于nginx 反向代理之 proxy_pass的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)nginx 反向代理 proxy_pass內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

標(biāo)簽:忻州 延安 辛集 西安 海西 邯鄲 南通 臨汾

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《nginx 反向代理之 proxy_pass的實(shí)現(xiàn)》,本文關(guān)鍵詞  nginx,反向,代理,之,proxy,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《nginx 反向代理之 proxy_pass的實(shí)現(xiàn)》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于nginx 反向代理之 proxy_pass的實(shí)現(xiàn)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章