描述:在用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启动失败/报错(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket...permissions) nginx启动失败

    出现这个问题是因为80端口被占用了 1.cmd输入命令netstat -aon|findstr "80" 2..查看80端口 16356对应的任务 输入命令 tasklist|fi ...

随机推荐

  1. KMP 模式串匹配 失去匹配的瞬间你还有什么

    KMP: KMP算法是一种改进的字符串匹配算法,由D.E.Knuth,J.H.Morris和V.R.Pratt同时发现,因此人们称它为克努特——莫里斯——普拉特操作(简称KMP算法).KMP算法的关键 ...

  2. P1099 树网的核

    NOIP 2007 提高第四题. 啊......我还是看了题解才做出来的. 这题乍一看毫无头绪,但是我们spy on一下,暗中观察发现:n才300!随便打暴力水过去啊! 然后,这破题怎么暴力?感觉我的 ...

  3. Spring实现文件的上传下载

    背景:之前一直做的是数据库的增删改查工作,对于文件的上传下载比较排斥,今天研究了下具体的实现,发现其实是很简单.此处不仅要实现单文件的上传,还要实现多文件的上传. 单文件的下载知道了,多文件的下载呢? ...

  4. JAVA:当数据库重启后连接池没有自动识别的解决办法

    今天发现服务器上的一个服务程序出现问题,软件抛出:Connection reset by peer: socket write error 无法正常提供服务,找了一下原因,原来是因为数据库服务器重启, ...

  5. MATLAB:图像乘除法运算(immultiply、imdivide函数),同时比较双精度类型图像运算结果

    图像乘除法运算涉及到immultiply.imdivide函数,实现代码如下: 1.图像之间的乘法运算 close all; %关闭当前所有图形窗口,清空工作空间变量,清除工作空间所有变量 clear ...

  6. 让maven项目使用nexus作为远程仓库

    让maven项目使用nexus作为远程仓库有两种方式,第一种是在项目的pom.xml中进行更改,让单个项目使用nexus仓库:另一种是通过修改maven的配置文件settings.xml进行更改,让所 ...

  7. 【float】与【position】汇总

    代码示例: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  8. ELK 5.6.8 安装部署

    操作系统版本: LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64: ...

  9. javascript 体验定时器

    <script> // setInterval():循环定时器,循环执行 // setTimeout():炸弹定时器,只执行一次 //定义方法1:匿名函数 setInterval(func ...

  10. Ruby 集合数组常用遍历方法

    迭代器简介 先简单介绍一下迭代器. 1.一个Ruby迭代器就是一个简单的能接收代码块的方法(比如each这个方法就是一个迭代器).特征:如果一个方法里包含了yield调用,那这个方法肯定是迭代器: 2 ...