Nginx 端口转发
指定 uri 转发到指定端口
#user root; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # 日志格式 log_format main '$remote_addr [$time_local] "$request" "$request_uri"'; server { server_name 127.0.0.1; listen 80; # return 302 http://$host:8080$request_uri; # 访问日志 access_log logs\access.log main; # 匹配 /fis/outh/ 开头,转发到 8080 端口 location ^~ /fis/outh/ { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # 匹配 .auth2 结尾,转发到 8080 端口 location ~*.(auth2)$ { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } }