worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; client_max_body_size 20m; sendfile on; keepalive_timeout 65; server { listen 9989; server_name 127.0.0.1; client_max_body_size 2000M; location /old/{ #代理到目录 proxy_pass http://127.0.0.1:8989/; proxy_set_header Host $host:$server_port; #非80端口时要配置 host和端口 proxy_set_header X-Real-IP $remote_addr; #真实ip proxy_set_header X-ContextPath /old; #配合wcp的request方法重构,传入contextPath #proxy_cookie_path /wcp /old; #解决代理到目录时的cookie刷新问题,把/wcp改写到/old #proxy_set_header Cookie $http_cookie; #cookie传递 #proxy_redirect off; } } }