- 論壇徽章:
- 0
|
把nginx放到了squid后面,一般的server都沒(méi)有問(wèn)題,有一個(gè)server里面使用了proxy mod,這時(shí)通過(guò)squid訪問(wèn)proxy過(guò)得url就會(huì)504,而直接訪問(wèn)沒(méi)有問(wèn)題,具體描述:
1.nginx配置
server {
listen 192.168.0.10:80;
server_name tech.test.com;
proxy_next_upstream error;
location = /data/js/config.js {
root /opt/tmp/test;
}
location /news {
proxy_pass http://news.test.net;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
起來(lái)后直接訪問(wèn)http://tech.test.com/data/js/config.js和http://tech.test.com/news/xx.html沒(méi)有問(wèn)題
2.前面加上一個(gè)squid,通過(guò)squid訪問(wèn)http://tech.test.com/data/js/config.js沒(méi)有問(wèn)題,訪問(wèn)http://tech.test.com/news/xx.html就會(huì) 504 gateway timeout,nginx錯(cuò)誤日志:
- 2008/09/23 08:58:43 [error] 17645#0: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: tech.test.com, request: "GET /news/2008/0912/16357.html HTTP/1.0", upstream: "http://192.168.0.16:80/news/2008/0912/16357.html", host: "tech.test.com"
復(fù)制代碼
怎么解決呢?謝謝 |
|