安装启动nginx配置以后,访问报502错误,然后查看nginx的错误日志

[root@hdss7-200 nginx]# tail -f /var/log/nginx/error.log
2021/04/19 13:24:26 [notice] 23868#0: signal process started
2021/04/19 13:30:54 [crit] 23869#0: *1 connect() to 127.0.0.1:180 failed (13: Permission denied) while connecting to upstream, client: 10.4.7.200, server: harbor.od.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:180/", host: "harbor.od.com"

解决方法,执行以下命令

setsebool -P httpd_can_network_connect 1

参考文档:

nginx访问报错:connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream解决
https://blog.csdn.net/hunhun1122/article/details/103182718

SETLinux 相关
http://blog.chinaunix.net/uid-26727991-id-3235275.html

Redhat从FC3开始,就使用了SELinux来增强安全,如果想要关闭,需要修改/etc/selinux/config文件中的SELINUX=”" 为 disabled ,然后重启。

更多推荐