使用以下nginx.conf
在Windows上作为反向代理运行nginxhttp {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8082;
server_name localhost;
location / {
proxy_pass http://192.168.12.211:8082;
proxy_redirect http://192.168.12.211/ http://localhost:8080/;
proxy_set_header Host $host;
}
}
}
这是卷曲o / p。
c:\curl>curl -I http://localhost:8082
HTTP/1.1 303 See Other
Server: nginx/1.9.9
Date: Wed, 20 Jan 2016 10:30:38 GMT
Content-Type: text/html
Connection: keep-alive
Access-Control-Allow-Origin: *
location: http://192.168.12.211:8080/test.htm?Id=12345678
我希望响应中收到的“location
”标头被重写,如nginx.conf文件中的proxy_redirect
指令所示。基本上
必须改写为
我在nginx配置中缺少什么?任何提示都赞赏。