(1) nginx配置文件
server { listen 8886; 【8886是前端项目在nginx下的监听端口】 server_name 127.0.0.1; location /{ proxy_pass http://127.0.0.1:8083/YZT3.0/; 【8083是前端项目在tomcat下对应的端口】 } location /hmyj{ proxy_pass http://服务器ip地址:9021/hmyj; } } server { listen 8887; 【8887是前端项目在nginx下的监听端口】 server_name 127.0.0.1; location /{ proxy_pass http://127.0.0.1:8083/zjgIM/; 【8083是前端项目在tomcat下对应的端口】
} location /zjgyj{ proxy_pass http://服务器ip地址:19099/zjgyj; } }
(2) 调用时的写法
url: "/zjgyj/zbzsfacade/queryRecentlyList",
(3) 启动nginx
start nginx
./nginx -t
./nginx -s reload
(4) 启动tomcat