nginx proxy_pass解釋

在當前大部分對外提供的web服務會使用nginx作負載均衡,平常相關的proxy_pass設置有:html

以http://192.168.1.101/proxy/test.html進行訪問爲例子nginx

第一種:      note :/proxy/能夠用其餘的代替,或者增長多級目錄web

location /proxy/ {負載均衡

   proxy_pass http://192.168.1.102/ ;url

}  spa

代理生成的url   http://192.168.1.102/test.html代理

第二種:(相關於第一種,最後少一個/)htm

location /proxy/ {io

   proxy_pass http://192.168.1.102 ;test

}  

代理生成的url   http://192.168.1.102/proxy/test.html

第三種:

location /proxy/ {

   proxy_pass http://192.168.1.102/aaa/ ;

}  

代理生成的url   http://192.168.1.102/aaa/test.html

第四種:

location /proxy/ {

   proxy_pass http://192.168.1.102/aaa ;

}  

代理生成的url   http://192.168.1.102/aaatest.html

相關文章
相關標籤/搜索