故障 -> nginx启动失败
描述:在用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启动失败的更多相关文章
- 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 启动失败 ...
- Win7 Nginx启动失败 cmd命令失败
Win7 Nginx启动失败 cmd命令失败 Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服 ...
- 解决Nginx启动失败
一.Nginx下载http://nginx.org/en/download.html 二.Nginx启动失败原因1.本人下载的是nginx-1.12.1(稳定版),下载完解压后,进入路径中,start ...
- 解决GitLab的Forbidden和Nginx启动失败
通过宝塔安装的GitLab突然出现Forbidden,原因居然是IP并发过大,IP被禁 解决方法: 登录服务器,编辑文件 /etc/gitlab/gitlab.rb ,将下面的截图内容放开注释(默认 ...
- 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 ...
- 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 ...
- 阿里云安装nginx 启动失败的原因。
阿里云编译安装nginx服务器后启动一直报下面错误. 百度了一圈,看到一个说要先关掉apache服务,感觉这个好像是对的,立马做了下面操作. 果然把nginx起了起来. 从这边才知道apache和ng ...
- nginx启动失败:Redirecting to /bin/systemctl start nginx.service Failed to start nginx.service: Unit not found.
解决方法: 是因为nginx没有有添加到系统服务,手动手动添加一个即可. 在 /etc/init.d/下创建名为nginx的启动脚本即可,内容如下: #!/bin/bash # # chkconfig ...
- 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 ...
随机推荐
- JVM复习总结
运行时数据区域 图中深色区域为,由所有线程共享的数据区域,其他为线程隔离的数据区. 程序计数器 程序计数器可以看作是当前线程执行的字节码的行号指示器. 虚拟机栈 虚拟机栈描述的是Java方法执行的内存 ...
- HTTP/1.1 100 Continue - I 服了 You
今天用 c 的 socket() 模拟发送http请求:上传一张图片到服务器. 在本地测试,本地电脑: xp, iis5.1 经过半天时间对 http post file 协议的了解,代码已经写好,测 ...
- spread与react
我们写react组件的过程中会遇到这个 我们知道react中的{},浏览器会知道说是以js的形式进行解析出来.那么怎么解析...props呢? 这个就涉及到es6中的扩展运算符了,我们先看下面的一些运 ...
- pow log 与 (int)
1.不能用%d输出double类型的数 double a1=5.3; double a2=1234.1234; double a3=3412341.12341234; double b1=1.5; d ...
- c#连接Redis Redis的安装与配置
Redis是一个不错的缓存数据库,读取数据速度效率都很不错.今天大家共同研究下redis的用法.结合网上的资料和自己的摸索,先来看下安装与配置把. 咱们主要看在WINDOWS上怎样使用REDIS数据库 ...
- wagger的展示路径修改
转:https://www.jianshu.com/p/ce7e247515f5?utm_source=oschina-app 注:本文是基于springboot配置实现,但在实际中使用springm ...
- webstorm的一些小技巧
1.怎样禁止自动保存文件: 设置--->外观和行为--->常规--->Synchronization--->要么四个全不选,要么把最后两个不选 Settings--->A ...
- python写GUI
图形用户界面 本文利用wxpython wx包中的方法都是以大写的字幕开头 import wx def load(event): file = open(filename.GetValue()) co ...
- Spring + Mybatis 读写分离
项目背景:项目开发中数据库使用了读写分离,所有查询语句走从库,除此之外走主库. 实现思路是: 第一步,实现动态切换数据源:配置两个DataSource,配置两个SqlSessionFactory指向两 ...
- 金融量化分析【day113】:PGEC策略
一.PGE简介 二.PGE代码 # 导入函数库 import jqdata import pandas as pd def initialize(context): set_benchmark('00 ...