ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
nginx.cnf配置 ~~~ upstream tomcat_server { server 10.25.39.131:8080; server 10.25.39.132:8080; } server { listen 80; server_name www.wxvote.com; ##设置欢迎页 location = / { root WeiXinVote; index index.html; } location ~* \.(html|css|js|gif|jpg|jpeg|mp4|ttf|eot|svg|woff)$ { root WeiXinVote; } ##注意:前面必须加^~ ,提升配置的优先级。 location ^~ /upload/ { proxy_pass http://tomcat_server/upload/; proxy_set_header Host $host; } location / { proxy_pass http://tomcat_server/WeiXinVote/; proxy_set_header Host $host; } } ~~~ 注意,在后台代码中,请求重定向会加上工程名,redirect:/WeiXinVote/xx, Spring MVC环境下,Spring MVC会自动添加工程名,导致nginx环境下,访问路径出错。 解决方案:部署项目的时候,不要工程名。 部署2套工程的动静分析,根据域名反向代理 ~~~ upstream tomcat_server { server 10.25.39.131:8080; server 10.25.39.132:8080; } server { listen 80; server_name www.wxvote.com; location ~* \.(html|css|js|gif|jpg|jpeg|mp4)$ { root WeiXinVote; } location / { proxy_pass http://tomcat_server/WeiXinVote/; proxy_set_header Host $host; } } server { listen 80; server_name www.neusoft.com; location ~* \.(html|css|js|gif|jpg|jpeg|mp4)$ { root neusoft; } location / { proxy_pass http://tomcat_server/neusoft/; proxy_set_header Host $host; } } ~~~