- web工程1:
tomcat的访问路径:http://localhost:18880/aa
nginx的访问路径:http://localhost:8888/first-path/aa - web工程2:
tomcat的访问路径:http://localhost:18881/first-path/aa
nginx的访问路径:http://localhost:8888/firstPath/aa
http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #web工程1 upstream nana { server localhost:18880; } #web工程2 upstream nananana { server localhost:18881; } server { listen 8888; server_name localhost; location / { root html; index index.html index.htm; } #web工程1 location ^~/first-path/ { proxy_pass http://nana/; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 5s; } #web工程2 location /firstPath { proxy_pass http://nananana/first-path; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 5s; } }