在nginx環境下,直接用域名訪問(首頁)


 

①:

 

 

server {
listen 80;
server_name www.njm1.com;

location = / {    #=/規則可以直接訪問域名。如:www.njm1.com。跳轉到http://192.168.177.132:8080/njm1/test1/index_html;
proxy_pass http://192.168.177.132:8080/njm1/test1/index_html;
}

location ~ .*\.(js|css.jpg.png)?$  #靜態文件配置。必須要加,不然找不到你tomcat的靜態文件。如下的proxy_pass http://192.168.177.132:8080;就是轉到了tomcat,然后才能正常加載你的靜態文件
{
proxy_pass http://192.168.177.132:8080;
}

#負載均衡
location /njm1/test1/ {
proxy_pass http://tomcats;
}
}

 

②:springmvc 如下(加了/njm1/test1/這個前綴)

 

html文件如下:(加了/njm1/test1/這個前綴)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM