第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

nginx通過url訪問本機(jī)不同tomcat

nginx通過url訪問本機(jī)不同tomcat

紫衣仙女 2019-05-21 16:32:24
如何通過nginx來訪問本機(jī)開放的不同端口的tomcat,比如本機(jī)有六個(gè)tomcat分別為tomcat18080tomcat28081tomcat38082tomcat48083tomcat58084tomcat68085然后服務(wù)器新部署nginx服務(wù),讓所有的服務(wù)都能通過nginx的80來訪問比如http://192.168.102.100/tomcat1訪問tomcat1下面的項(xiàng)目http://192.168.102.100/tomcat2訪問tomcat2下面的項(xiàng)目http://192.168.102.100/tomcat3訪問tomcat3下面的項(xiàng)目http://192.168.102.100/tomcat4訪問tomcat4下面的項(xiàng)目
查看完整描述

2 回答

?
冉冉說

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超1個(gè)贊

通過配置文件反向代理即可,在nginx.conf中增加如下location,并將localhost改為需要的ip。
server{
location/tomcat1{
proxy_set_headerX-Real-IP$remote_addr;
proxy_passhttp://localhost:8081;
}
location/tomcat2{
proxy_set_headerX-Real-IP$remote_addr;
proxy_passhttp://localhost:8082;
}
location/tomcat3{
proxy_set_headerX-Real-IP$remote_addr;
proxy_passhttp://localhost:8083;
}
}
                            
查看完整回答
反對(duì) 回復(fù) 2019-05-21
?
GCT1015

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超4個(gè)贊

//把nginx默認(rèn)的配置文件備份下,改改就可以了。server{????????#這是你要代理到的80端口????????listen????80;????????#這是訪問的域名????????server_name??http://localhost;
????????roothtml;
????????access_log??logs/nginx.access.log??main;????????????????#然后下面才是你要代理的幾個(gè)tomcat?????????#默認(rèn)請(qǐng)求????????location/{????????????indexindex.phpindex.htmlindex.htm;??????????}????????location/tomcat1{
proxy_set_headerX-Real-IP$remote_addr;
proxy_passhttp://localhost:8081;
}
location/tomcat2{
proxy_set_headerX-Real-IP$remote_addr;
proxy_passhttp://localhost:8082;
}
location/tomcat3{
proxy_set_headerX-Real-IP$remote_addr;
proxy_passhttp://localhost:8083;
}
#其他配置略
}
                            
查看完整回答
反對(duì) 回復(fù) 2019-05-21
  • 2 回答
  • 0 關(guān)注
  • 1288 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)