worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { #监听80端口 listen 80; server_name localhost; #charset utf-8; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } #如果是其他项目就转发到8080端口 location / { proxy_pass http://127.0.0.1:8080; } #如果包含/aaa/就转发到9001端口 location ^~ /aaa/ { proxy_pass http://127.0.0.1:9001; } #如果包含/bbb/就转发到9002端口 location ^~ /bbb/ { proxy_pass http://127.0.0.1:9002; } } }