我正在尝试在nginx后面运行一个squid服务器.我像这样配置了nginx:
server {
listen 8080;
location / {
proxy_pass http://localhost:3128;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Run Code Online (Sandbox Code Playgroud)
然后我将我的http网络代理设置为:
my-nginx-server-address:8080
Run Code Online (Sandbox Code Playgroud)
因此,当我尝试查看Google主页时,nginx会收到请求:
Get http://www.google.com/ HTTP/1.1
Run Code Online (Sandbox Code Playgroud)
但是当nginx将请求传递给squid时,它会将request_uri更改为
/
Run Code Online (Sandbox Code Playgroud)
所以鱿鱼不行.有什么办法可以将request_uri设置回http://www.google.com然后将其传递给squid吗?或者我可以在nginx后面运行鱿鱼的任何其他方式?
尝试 proxy_set_header 请求 URI $request_uri;
在回复您的评论时,您可能还希望添加:
upstream _squid {
server localhost:3128;
}
server {
...
proxy_pass http://_squid/$host$uri;
}
| 归档时间: |
|
| 查看次数: |
3870 次 |
| 最近记录: |