upstream uplocal3{ server localhost:9800; }
server { listen 80; server_name www.hbjdzx.org.cn;
location /{
proxy_connect_timeout 3;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_pass http://uplocal3/TrainHelper/site/;
# proxy_pass http://192.168.1.111:9800/TrainHelper/site/;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
}
}
直接访问 http://192.168.1.111:9800/TrainHelper/site/的话可以请求的到, 但配置 Nginx 反向代理就请求不到,求各位大神帮忙,看下配置有什么问题。
1
whx20202 2016-10-26 21:46:00 +08:00
看一下 access_log ?
|
2
qzf OP 下面是请求 http://www.hbjdzx.org.cn/的日志
- [26/Oct/2016:13:08:26 +0000] - 192.168.1.104 GET / HTTP/1.1 - 192.168.1.111:9800 -GET / HTTP/1.1www.hbjdzx.org.cnups_resp_time: 0.016 request_time: 0.016 - [26/Oct/2016:13:24:07 +0000] - 192.168.1.104 GET / HTTP/1.1 - 127.0.0.1:9800 -GET / HTTP/1.1www.hbjdzx.org.cnups_resp_time: 0.344 request_time: 0.344 |
3
cheetah 2016-10-26 23:25:01 +08:00
感觉是 proxy_pass 的问题
|
4
liangmishi 2016-10-27 00:01:34 +08:00 via Android
proxy_pass http://192.168.1.111:9800;
|
5
qzf OP |
6
liyvhg 2016-10-27 08:48:46 +08:00
@qzf proxy_pass http://localhost:8000/uri/;
参考资料: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass |