参考文档:Nginx 启动报 [emerg] bind() to 0.0.0.0:XXXX failed (13: Permission denied)错误处理

nginx 启动失败: 检测语法正常,启用端口报错:[emerg] bind() to 0.0.0.0:XXXX failed (13: Permission denied)错误处理

nginx启动报错详细日志
[root@localhost conf.d]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy serverLoaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)Active: failed (Result: exit-code) since Mon 2022-08-01 22:24:46 KST; 2min 50s agoProcess: 27391 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)Process: 27600 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)Process: 27598 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)Main PID: 27392 (code=exited, status=0/SUCCESS)Aug 01 22:24:46 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...
Aug 01 22:24:46 localhost.localdomain nginx[27600]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Aug 01 22:24:46 localhost.localdomain nginx[27600]: nginx: [emerg] bind() to 0.0.0.0:8885 (13: Permission denied) 《===报错信息
Aug 01 22:24:46 localhost.localdomain nginx[27600]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 01 22:24:46 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 01 22:24:46 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Aug 01 22:24:46 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Aug 01 22:24:46 localhost.localdomain systemd[1]: nginx.service failed.
[root@localhost conf.d]#
[root@localhost conf.d]#
[root@localhost conf.d]# journalctl -xe
Aug 01 22:24:46 localhost.localdomain nginx[27600]: nginx: [emerg] bind() to 0.0.0.0:8885 failed (13: Permission denied) 《===报错信息
Aug 01 22:24:46 localhost.localdomain nginx[27600]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 01 22:24:46 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 01 22:24:46 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Aug 01 22:24:46 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Aug 01 22:24:46 localhost.localdomain systemd[1]: nginx.service failed.
Aug 01 22:24:46 localhost.localdomain polkitd[620]: Unregistered Authentication Agent for unix-process:27592:10276196 (system bus name :1.223, object path /org/freedesktop/PolicyKit1/Authenti
Aug 01 22:27:13 localhost.localdomain kernel: SELinux: 2048 avtab hash slots, 113338 rules.
Aug 01 22:27:13 localhost.localdomain kernel: SELinux: 2048 avtab hash slots, 113338 rules.
Aug 01 22:27:14 localhost.localdomain kernel: SELinux:  8 users, 14 roles, 5051 types, 318 bools, 1 sens, 1024 cats
Aug 01 22:27:14 localhost.localdomain kernel: SELinux:  130 classes, 113338 rules
Aug 01 22:27:14 localhost.localdomain kernel: SELinux:  Converting 2343 SID table entries...
Aug 01 22:27:16 localhost.localdomain dbus[617]: [system] Reloaded configuration
Aug 01 22:27:20 localhost.localdomain kernel: SELinux: 2048 avtab hash slots, 113338 rules.
Aug 01 22:27:20 localhost.localdomain kernel: SELinux: 2048 avtab hash slots, 113338 rules.
Aug 01 22:27:20 localhost.localdomain kernel: SELinux:  8 users, 14 roles, 5051 types, 318 bools, 1 sens, 1024 cats
Aug 01 22:27:20 localhost.localdomain kernel: SELinux:  130 classes, 113338 rules
Aug 01 22:27:20 localhost.localdomain kernel: SELinux:  Converting 2343 SID table entries...
Aug 01 22:27:23 localhost.localdomain dbus[617]: [system] Reloaded configuration
Aug 01 22:27:26 localhost.localdomain kernel: SELinux: 2048 avtab hash slots, 113338 rules.
Aug 01 22:27:26 localhost.localdomain kernel: SELinux: 2048 avtab hash slots, 113338 rules.
Aug 01 22:27:26 localhost.localdomain kernel: SELinux:  8 users, 14 roles, 5051 types, 318 bools, 1 sens, 1024 cats
Aug 01 22:27:26 localhost.localdomain kernel: SELinux:  130 classes, 113338 rules
Aug 01 22:27:26 localhost.localdomain kernel: SELinux:  Converting 2343 SID table entries...
Aug 01 22:27:29 localhost.localdomain dbus[617]: [system] Reloaded configuration

系统启动Nginx报错: [emerg] bind() to 0.0.0.0:XXXX failed (13: Permission denied)错误的处理方式,分为两种:

第一种:端口小于1024的情况:

[emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

原因是1024以下端口启动时需要root权限,所以sudo nginx即可。 或者 修改/etc/nginx/nginx.conf 配置文件将user nginx;改成 user root;

第二种:端口大于1024的情况:

[emerg] bind() to 0.0.0.0:8885 failed (13: Permission denied)

这种情况,需要如下操作:
1、查看http允许访问的端口:

semanage port -l | grep http_port_t
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988

2、将要启动的端口(8881)加入到如上端口列表中

semanage port -a -t http_port_t  -p tcp 8885

nginx填坑之路(1)Nginx 检测语法正常,启用报 [emerg] bind() to 0.0.0.0:XXXX failed (13: Permission denied)错误处理...相关推荐

  1. 【庖丁解牛】成功解决nginx报错:bind() to 0.0.0.0:8090 failed (13: Permission denied)

    文章目录 错误复现 错误原因 解决方案 错误复现 在nginx设置基于端口的虚拟主机的时候,设定两个端口,一个是80,一个是8090, 在重启nginx的时候 [root@zmedu-17 rpm]# ...

  2. nginx bind() to 0.0.0.0:**** failed (13: Permission denied)

    nginx 启动失败,日志里面报错信息如下: Starting nginx: nginx: [emerg] bind() to 0.0.0.0:**** failed (13: Permission ...

  3. php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误...

    这里选择直接apt-get安装,因为比起自己编译简单多了,不需要自己配置什么 #sudo apt-get install curl libcurl3 libcurl3-dev php5-curl 安装 ...

  4. nginx反向代理tomcat提示failed (13: Permission denied) while connecting to upstream

    2019独角兽企业重金招聘Python工程师标准>>> nginx反向代理tomcat提示failed (13: Permission denied) while connectin ...

  5. 解决Mac nginx问题 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

    brew services restart nginx Stopping nginx... (might take a while) ==> Successfully stopped nginx ...

  6. Failed:(13: Permission denied)导致访问浏览器出现Nginx 500 Internal Server Error

    1 .问题 我在部署nginx反向代理服务器的时候,nginx.conf文件都配置好了,但是我在浏览器里面输入域名的时候,提示Nginx 500 Internal Server Error 2.分析 ...

  7. (Nginx出现403 forbidden)nginx权限问题failed(13:Permission denied)

    启动nginx发现前端出现问题 logs下的error.log 发现如下警告 检查nginx错误日志 错误如下 2022/02/08 16:40:06 [error] 19486#0: *25 ope ...

  8. open() /usr/local/nginx/nginx-1.8.1/client_body_temp/0000000297 failed (13: Permission denied),

    这两天遇到项目中APP调用后台接口时,接口调不通,在电脑上连上开发环境能调通接口,猜想可能是因为APP是外网原因,尝试将APP端URL直接换成IP形式也调不通(由于办公室及开发机器都在内网,APP连上 ...

  9. 2022-06-28 Nginx connect() to xxx.xx.xx.xxx:xxxxx failed (13: Permission denied)

    Nginx 502 访问路由页面出错,查看/var/log/ngxin/error.log提示:(13:Permission denied)问题 Linux执行命令: 1.关闭SeLinux1.临时关 ...

最新文章

  1. 使用JAXP对xml文档进行DOM解析基础
  2. h3c 3600 交换机配置Telnet登录
  3. 如何高性能添加UIView阴影
  4. 腾讯后台开发面试题--整理1
  5. APUE-文件和目录(二)函数access,mask,chmod和粘着位
  6. hadoop2 5个环境配置文件
  7. 大数据项目开发案例_大数据分析技术——项目案例1(猫眼电影数据分析上)...
  8. 【半译】两个gRPC的C#库:grpc-dotnet vs Grpc.Core
  9. 运维人员日常工作(转自老男孩)
  10. 如何在Qt中使用自定义数据类型
  11. nginx 日志过滤网络爬虫
  12. AWS想到办法让Alexa能在毫秒内做出回复
  13. Elasticsearch 安装随笔
  14. 进化计算-进化策略(Evolutionary Strategies,ES)前世今生与代码共享
  15. FreeType需要libpng的说明(编译时可以用参数去掉,2.12已支持svg)
  16. 【信息安全技术】RSA算法的研究及不同优化策略的比较
  17. 如何成为牛逼的程序员
  18. Hibernate实战——双向N-N关联
  19. 雷克萨斯品牌舆情监测-危机后,如何重新赢得消费者的认可?
  20. xshow-2. 使用HTML 5 Boilerplate构建前端

热门文章

  1. 新概念英语1册51课
  2. conda anaconda切换清华源
  3. 字符‘9‘跟整数9之间该如何相互转换
  4. html功能性链接邮箱,HTML格式自定义OpenCart邮件模板功能插件
  5. EXcel为什么按序号排序后会出现1、11、12....2、20的现象而不是1、2、3这样的按次序,怎么解决?
  6. 基于Bayer的数字图像还原
  7. 动手学深度学习10:汇聚层(pooling)
  8. QGIS二次开发地图添加标记添加注记Svg小图标SvgItem
  9. Alienware上线首个数字时装AR试穿体验
  10. salesforce apex常用方法(总结)