nginx 代理 tomcat 502 bad gateway

来源:互联网 发布:在计算机领域 数据是 编辑:程序博客网 时间:2024/05/22 14:53
nginx能收到80请求,但是无法转到tomcat:8080.
直接访问http://x.x.x.x:8080/project 可以访问
查看/var/log/nginx/error.log
2015/04/01 11:38:13 [crit] 2895#0: *10 connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, client: 10.12.70.206, server: localhost:8080, request: "GET /bpp HTTP/1.1", upstream: "http://127.0.0.1:8080/app", host: "10.11.202.204"
解决方案:
http://stackoverflow.com/questions/25235453/nginx-proxy-server-localhost-permission-denied

I was able to find a solution after 2 days of searching. Somehow SELinux was not permitting Nginx to proxy to my server. Running the command below fixed the issue.

-P permanent的意思

 /usr/sbin/setsebool -P httpd_can_network_connect true 
0 0
原创粉丝点击