【发布时间】:2017-12-13 04:13:08
【问题描述】:
我在 docker 中使用 nginx,这是我的 nginx 配置
server { listen 80; server_name saber;
location / {
root /usr/share/nginx;
index index.html;
}
location /saber {
proxy_pass http://localhost:8080;
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;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_connect_timeout 90;
}
}
当我在浏览器中使用“http://localhost/saber/blog/getBlog.do”时,浏览器给我一个错误“502”。 和 nginx 的 error.log 有新的。
2017/07/09 05:16:18 [warn] 5#5: *1 upstream server temporarily disabled while connecting to upstream, client: 172.17.0.1, server: saber, request: "GET /saber/blog/getBlog.do HTTP/1.1", upstream: "http://127.0.0.1:8080/saber/blog/getBlog.do", host: "localhost"
我可以保证“http://127.0.0.1:8080/saber/blog/getBlog.do”在浏览器中响应成功。
我尝试在其他问题中搜索答案,我发现答案是“/usr/sbin/setsebool httpd_can_network_connect true”,这是问题网址“nginx proxy server localhost permission denied”,但我在win10中使用docker,nginx容器dont hava setsebool,because the container dont找到 SELinux。
这一切,提前谢谢你。
【问题讨论】: