故障 -> 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 ...
随机推荐
- pthread_cond_wait() 函数的使用
1. 首先pthread_cond_wait 的定义是这样的 The pthread_cond_wait() and pthread_cond_timedwait() functions are us ...
- apache加载模块的说明
转: apache加载模块的说明 2017年04月11日 15:23:35 刚子狂想 阅读数:1432 LoadModule auth_basic_module modules/mod_auth_ ...
- idea 注释中的错误不再提示
- Redis集群中的节点如何保证数据一致
主从复制: 1.redis的复制功能是支持多个数据库之间的数据同步.一类是主数据库(master)一类是从数据库(slave),主数据库可以进行读写操作,当发生写操作的时候自动将数据同步到从数据库,而 ...
- django中的数据库外键操作
以MYSQL为例: (1)在model中定义两个数据表,食物信息和食物类别信息 class foodInfo(models.Model): food_id = models.AutoField ...
- java内存模型及内存与cpu之间的关系
主内存和cpu之间的关系,因为cpu是在是处理速度太快了.所以一般cpu都有一个cpu缓存,上图的意思是主内存--->cpu缓存--->cpu寄存器--->cpu执行处理,写的时候反 ...
- Spark记录-SparkSql官方文档中文翻译(部分转载)
1 概述(Overview) Spark SQL是Spark的一个组件,用于结构化数据的计算.Spark SQL提供了一个称为DataFrames的编程抽象,DataFrames可以充当分布式SQL查 ...
- JAVA记录-添加错误页面友好提示
1.web.xml加入以下配置 <error-page> <error-code>404</error-code> <location>/WEB-INF ...
- spring boot(十):定时任务
springboot默认已经帮我们实行了,只需要添加相应的注解就可以实现. 1.pom包配置 <dependency> <groupId>org.springframework ...
- 如何学好web安全
web服务组件: 横向就是如图所示,纵向就是数据流:数据流说白了就是http协议. 举例: 1.如果在操作系统没有处理好,就产生了OS命令执行的安全问题: 2.如果在存储层的数据库中没有处理好,数据库 ...