解决Nginx的failed 13 Permission denied while connecting to upstream
一、问题
最近在用nginx做反向代理的时候遇到这样一个问题:
1 | 2024/02/19 17:15:32 [crit] 3025#3025: *2 connect() to 127.0.0.1:19010 failed (13: Permission denied) while connecting to upstream, client: 10.64.68.30, server: , request: "POST /opticTransceiver/addDeviceList HTTP/1.1", upstream: "http://127.0.0.1:19010/opticTransceiver/addDeviceList", host: "localhost:8080", referrer: "http://localhost:8080/device-connect" |
二、原因
是因为SeLinux的限制。
三、解决
1.关闭SeLinux的限制
1) 临时关闭(不用重启机器)
1 | setenforce 0 ##设置SELinux 成为permissive模式 |
2) 修改配置文件(需要重启机器)
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可
2.执行下面的命令
1 | setsebool -P httpd_can_network_connect 1 |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 张晓风的博客!
评论