nginx 配置 tomcat 多服务请求拦截
#tomcat配置 worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #前端页面服务器 server { #监听端口和域名 listen 80; #nginx 端口 server_name localhost; #添加拦截路径和根目录 #root "C:/Users/Admin/Desktop/A/src/main/webapp/"; #添加拦截路径和代理地址 location / { #根目录 root /root; proxy_pass http://localhost:8080/; #tomcat端口以及地址 } #添加拦截路径和代理地址 后端代码端口以及 context-path: /api location /api/ { #请求拦截到的URL proxy_pass http://localhost:8090/api/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; index index.html index.htm; } } }