Home >Backend Development >PHP Tutorial >nginx proxy tomcat 502 bad gateway

nginx proxy tomcat 502 bad gateway

WBOY
WBOYOriginal
2016-07-29 09:15:452296browse

nginx can receive 80 requests, but cannot be transferred to tomcat:8080.

Directly access http://x.x.x.x:8080/project. You can visit

to view /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"

Solution:

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 Meaning /usr/sbin/setsebool -P httpd_can_network_connect true

Copyright statement: This article is the original article of the blogger and may not be reproduced without the blogger's permission

.

The above introduces the nginx proxy tomcat 502 bad gateway, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn