故障 -> nginx启动失败

时间:2022-09-07 17:06:23

描述:在用saltstack给 minion 安装 nginx 服务 时 提示 nginx 服务下载成功,但是启动失败。

----------
ID: nginx-systemctl
Function: service.running
Name: nginx
Result: False
Comment: Service nginx failed to start
Started: ::48.221250
Duration: 3317.741 ms
Changes:
----------
nginx:
False

然后就去minion 端查看了一下 端口是否开启  netstat -lntup  发现没有nginx  进程也没有

然后手动起了一下 提示 如下报错:

[root@salt1-minion ~]# 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.

意思就是Nginx服务起不来了,然后查看一下状态吧, systemctl status nginx

[root@salt1-minion ~]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed -- :: CST; 15s ago
Process: ExecStart=/usr/sbin/nginx (code=exited, status=/FAILURE)
Process: ExecStartPre=/usr/sbin/nginx -t (code=exited, status=/SUCCESS)
Process: ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=/SUCCESS) Nov 21 09:33:37 salt1-minion nginx[1475]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Nov 21 09:33:37 salt1-minion nginx[1475]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in
use)
Nov :: salt1-minion nginx[]: nginx: [emerg] bind() to [::]: failed (: Address already in use)
Nov :: salt1-minion nginx[]: nginx: [emerg] bind() to 0.0.0.0: failed (: Address already in use)
Nov :: salt1-minion nginx[]: nginx: [emerg] bind() to [::]: failed (: Address already in use)
Nov :: salt1-minion systemd[]: nginx.service: control process exited, code=exited status=
Nov :: salt1-minion nginx[]: nginx: [emerg] still could not bind()
Nov :: salt1-minion systemd[]: Failed to start The nginx HTTP and reverse proxy server.
Nov :: salt1-minion systemd[]: Unit nginx.service entered failed state.
Nov :: salt1-minion systemd[]: nginx.service failed.

从报错信息中会看到,Address already in use ,意思就是地址已经被使用了。当时发现了自己的失误,原来是之前下载过httpd ,也是80端口。

那就去修改一下nginx 的配置文件吧 ,修改端口,去到 /etc/nginx/nginx.conf文件里,把端口修改为443

 server {
listen default_server;
listen [::]: default_server;

然后重新启动服务

[root@salt1-minion nginx]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /sshd
tcp 127.0.0.1: 0.0.0.0:* LISTEN /master
tcp 0.0.0.0:443 0.0.0.0:* LISTEN /nginx: master
tcp6 ::: :::* LISTEN /httpd
tcp6 ::: :::* LISTEN /sshd
tcp6 ::: :::* LISTEN /master
tcp6 ::: :::* LISTEN /nginx: master
[root@salt1-minion nginx]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Wed -- :: CST; 9s ago
Process: ExecStart=/usr/sbin/nginx (code=exited, status=/SUCCESS)

最后网页访问 主机加端口测试,没有问题。

故障 -> nginx启动失败的更多相关文章

  1. Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) nginx 启动失败

     Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied)     nginx 启动失败 ...

  2. Win7 Nginx启动失败 cmd命令失败

    Win7  Nginx启动失败 cmd命令失败 Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服 ...

  3. 解决Nginx启动失败

    一.Nginx下载http://nginx.org/en/download.html 二.Nginx启动失败原因1.本人下载的是nginx-1.12.1(稳定版),下载完解压后,进入路径中,start ...

  4. 解决GitLab的Forbidden和Nginx启动失败

    通过宝塔安装的GitLab突然出现Forbidden,原因居然是IP并发过大,IP被禁 解决方法: 登录服务器,编辑文件 /etc/gitlab/gitlab.rb  ,将下面的截图内容放开注释(默认 ...

  5. nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket...permissions)

    nginx启动失败 nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a ...

  6. Windows版Nginx启动失败之1113: No mapping for the Unicode character exists in the target multi-byte code page

    Windows版Nginx启动一闪,进程中未发现nginx进程,查看nginx日志,提示错误为1113: No mapping for the Unicode character exists in ...

  7. 阿里云安装nginx 启动失败的原因。

    阿里云编译安装nginx服务器后启动一直报下面错误. 百度了一圈,看到一个说要先关掉apache服务,感觉这个好像是对的,立马做了下面操作. 果然把nginx起了起来. 从这边才知道apache和ng ...

  8. nginx启动失败:Redirecting to /bin/systemctl start nginx.service Failed to start nginx.service: Unit not found.

    解决方法: 是因为nginx没有有添加到系统服务,手动手动添加一个即可. 在 /etc/init.d/下创建名为nginx的启动脚本即可,内容如下: #!/bin/bash # # chkconfig ...

  9. 如果nginx启动失败,错误解决

    解决上面问题: /usr/sbin/groupadd -f www /usr/sbin/useradd -g www www 这方法常见出现时反向代理时,ssl的授权用户不存在的情况下出现的:.

随机推荐

  1. C#-WebForm-WebForm开发基础

    1.C/S 客户端应用程序 WinForm WPF 平级 数据是存放在其他的电脑上或服务器上 需要从服务器上下载相应的数据,在本地电脑上的客户端里进行加工 数据的加工是在用户的电脑上执行的,会对用户的 ...

  2. EasyUI---tree

    EasyUI的tree在获取action返回的json字符串时最少具有三个属性id.text和children,这样在读取时才会在页面正常显示树形 这里比较重要的就是在数据库中对数据的存储吧,说白了还 ...

  3. [SoapUI] JDBC 请求连接SQL Sever,MySQL

    MySQLDriver: com.mysql.jdbc.DriverConnection string: jdbc:mysql://localhost:3306/xxx?user=xxx&pa ...

  4. WPF拖到、移动控件

    只需2个事件和一个point变量即可: Point mouse_offset = , ); void TC_MouseLeftButtonDown(object sender, MouseButton ...

  5. springMVC中一个class中的多个方法

    在前面.已经可以利用SpringMVC进行简单的例子了,但是,在controller中我们实现了Controller接口.这样就必须实现handleRequest(HttpServletRequest ...

  6. RobotFrame连接MySql数据库

    RobotFrame连接MySql数据库这类的教程网上并不多,就算有,也是很多坑.小编今天为大家提供一个靠谱的教程,但是具体的包需要大家自己下载.废话不多说,看疗效~~~ 1.pip install ...

  7. TensorFlow问题“The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.”

    出现的问题: 在使用TensorFlow跑官方教程例子时报以下warning: 虽程序能正常跑出结果,但作为一名强迫症患者对此很是不爽,于是查找资料找到隐藏该warning的解决办法. 解决办法: 在 ...

  8. 【sem竞价】点击量较多、咨询少怎么解决?

    点击量较多咨询少可能这种情况对于竞价技术专员来说比较常见的现象之一,在搜客大伟看来主要取决于两方面因素:一方面是外界环境因素影响:另一方面也就是我们下面主要介绍的sem竞价推广账户内部因素. 如下图, ...

  9. node_modules文件过长无法删除问题记录

    执行指令 rimraf node_modules

  10. hibernate的延迟加载和抓取策略

    一,延迟加载 1.实体类延迟加载 通过代理机制完成,由javassist类库实现运行时代理,修改实体类的字节码实现了运行时代理     <class lazy="true|false& ...