今天在配置tomcat 的反向代理的时候本来应该访问apache的8080端口的,结果出现了错误页面,查看了以下浏览器的Network,发现返回的是502-Bad Gateway
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
If you are the system administrator of this resource then you should check the error log for details.
Faithfully yours, nginx
查看了以下nginx的错误日志
通过下面命令查找error.log
sudo find / -type f -name error.log
返回
/var/log/nginx/error.log
查看了一下发现是13: Permission denied
的问题: nginx 转发 8080端口被拒绝
2019/12/18 12:01:52 [crit] 17371#17371: *46 connect() to
58.198.176.178:8080 failed (13: Permission denied) while
connecting to upstream, client: 172.31.254.248, server:
58.198.176.178, request: "GET / HTTP/1.1", upstream:
"http://58.198.176.178:8080/", host: "www.123.com"
于是在这篇博客找到了解决方法https://blog.csdn.net/henghenghalala/article/details/89247272
setsebool -P httpd_can_network_connect on
完美解决。