①:

在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/这个前缀)

在nginx环境下,直接用域名访问(首页)

 

html文件如下:(加了/njm1/test1/这个前缀)

在nginx环境下,直接用域名访问(首页)

 

相关文章:

  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2021-09-27
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案