当前位置: 首页 > news >正文

nginx启动失败问题集锦

1、selinux引起nginx启动失败

问题描述:

修改了nginx的配置文件,绑定了监听9089端口,重启nginx的时候失败了。发现报错“nginx: [emerg] bind() to 0.0.0.0:9089 failed (13: Permission denied)”:

[root@test101 nginx]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

[root@test101 nginx]# systemctl status nginx.service
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 五 2018-07-20 09:27:01 CST; 8s ago
     Docs: http://nginx.org/en/docs/
  Process: 50264 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 50329 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
 Main PID: 50243 (code=exited, status=0/SUCCESS)

7月 20 09:27:01 test101 systemd[1]: Starting nginx - high performance web server...
7月 20 09:27:01 test101 nginx[50329]: nginx: [emerg] bind() to 0.0.0.0:9089 failed (13: Permission denied)
7月 20 09:27:01 test101 systemd[1]: nginx.service: control process exited, code=exited status=1
7月 20 09:27:01 test101 systemd[1]: Failed to start nginx - high performance web server.
7月 20 09:27:01 test101 systemd[1]: Unit nginx.service entered failed state.
7月 20 09:27:01 test101 systemd[1]: nginx.service failed.

解决方法:

发现是因为selinux状态是enforcing,关闭了selinux再启动nginx就好了

[root@test101 nginx]# vim /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing         #改成disabled就OK了
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

2、OPENSSL引起nginx启动失败

问题描述:

在部署深圳电信nginx的时候,启动失败了,报错说找不到OPENSSL_1.0.2:

[root@host-172-0-0-11 conf.d]# systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

查看报错原因,发现提示“version `OPENSSL_1.0.2' not found”:

[root@host-172-0-0-11 conf.d]# systemctl status nginx.service
â— nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2018-08-02 11:11:40 CST; 7s ago
     Docs: http://nginx.org/en/docs/
  Process: 18995 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

Aug 02 11:11:40 host-172-51-121-11 systemd[1]: Starting nginx - high performance web server...
Aug 02 11:11:40 host-172-51-121-11 nginx[18995]: /usr/sbin/nginx: /lib64/libcrypto.so.10: version `OPENSSL_1.0.2' not found (required by /usr/sbin/nginx)
Aug 02 11:11:40 host-172-51-121-11 systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 02 11:11:40 host-172-51-121-11 systemd[1]: Failed to start nginx - high performance web server.
Aug 02 11:11:40 host-172-51-121-11 systemd[1]: Unit nginx.service entered failed state.
Aug 02 11:11:40 host-172-51-121-11 systemd[1]: nginx.service failed.

查看本机的openssl,发现本机的openssl确实与nginx要求的版本不符合

[root@host-172-51-121-11 conf.d]# rpm -qa openssl
openssl-1.0.1e-60.el7.x86_64
[root@host-172-0-0-11 conf.d]#

解决方法:

重新安装OPENSSL_1.0.2,然后启动nginx,成功

3、pid文件丢失,nginx起不来,页面无法访问

该问题见文章《一个因pid文件丢失,nginx的进程起不来,网站页面无法访问的故事》

转载于:https://blog.51cto.com/10950710/2309269

相关文章:

  • 第2章 变量和基本类型 附2 --声明和定义的区别
  • MySQL,binlog2sql回滚操作测试
  • 2015年9月30日的作业
  • 201771010126 王燕《面向对象程序设计(Java)》第九周学习总结
  • icomoon用法
  • [BZOJ] 2044: 三维导弹拦截
  • this class is not key value coding-compliant for the key XXX错误的解决方法
  • JavaSE小实践1:Java爬取斗图网站的所有表情包
  • LeetCode——Implement Trie (Prefix Tree)
  • 从普通程序员到身价过百亿:追求长期价值的耐心,决定了你能走多远
  • Android图形显示系统——概述
  • WPF中查看PDF文件
  • Jenkins——持续集成服务器
  • JVM里面hashtable和hashmap实现原理
  • iOS 10 的推送 User Notifications Framework
  • 【面试系列】之二:关于js原型
  • Angular 4.x 动态创建组件
  • Angular 响应式表单之下拉框
  • create-react-app项目添加less配置
  • EventListener原理
  • golang中接口赋值与方法集
  • Hexo+码云+git快速搭建免费的静态Blog
  • nginx 负载服务器优化
  • PHP那些事儿
  • Redis在Web项目中的应用与实践
  • spring学习第二天
  • Webpack 4x 之路 ( 四 )
  • 关于使用markdown的方法(引自CSDN教程)
  • 关于字符编码你应该知道的事情
  • 力扣(LeetCode)22
  • 跳前端坑前,先看看这个!!
  • 源码之下无秘密 ── 做最好的 Netty 源码分析教程
  • 自定义函数
  • media数据库操作,可以进行增删改查,实现回收站,隐私照片功能 SharedPreferences存储地址:
  • Nginx惊现漏洞 百万网站面临“拖库”风险
  • Spark2.4.0源码分析之WorldCount 默认shuffling并行度为200(九) ...
  • 曜石科技宣布获得千万级天使轮投资,全方面布局电竞产业链 ...
  • ​iOS安全加固方法及实现
  • ​人工智能之父图灵诞辰纪念日,一起来看最受读者欢迎的AI技术好书
  • (pojstep1.1.2)2654(直叙式模拟)
  • (pojstep1.3.1)1017(构造法模拟)
  • (保姆级教程)Mysql中索引、触发器、存储过程、存储函数的概念、作用,以及如何使用索引、存储过程,代码操作演示
  • (一)UDP基本编程步骤
  • (原創) 如何使用ISO C++讀寫BMP圖檔? (C/C++) (Image Processing)
  • (转)Android学习笔记 --- android任务栈和启动模式
  • (转)linux自定义开机启动服务和chkconfig使用方法
  • (转)Oracle存储过程编写经验和优化措施
  • (转)shell调试方法
  • ./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’: ./incl
  • .naturalWidth 和naturalHeight属性,
  • .NET开发不可不知、不可不用的辅助类(一)
  • /deep/和 >>>以及 ::v-deep 三者的区别
  • /etc/skel 目录作用
  • /usr/lib/mysql/plugin权限_给数据库增加密码策略遇到的权限问题
  • ?