问题描述:
(flaskApi) [root@67 flaskDemo]# service nginx start
Redirecting to /bin/systemctl start nginx.service
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

  确认问题:

  当不能使用service nginx start 开启或者使用service nginx stop 关闭时,查看systemctl status nginx 会有一定的错误提示

systemctl status nginx -l

  -l表示:可以展示全部错误信息,否则可能错误信息会被折叠

  Hint: Some lines were ellipsized, use -l to show in full.  

  返回的错误提示:

  从这里我们可以看出,是80端口被占用了

9月 17 14:54:21 67.59.247.60.static.bjtelecom.net nginx[25531]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

  通过命令查看80端口被哪个进程占用了

netstat -tpnul 

  可以看到是httpd,这个进程需要是24小时启动了,不能关掉

  所以接下来的解决办法有2种

    • 修改nginx的配置文件nginx.conf指定nginx启动时使用别的端口号,例如81
    • 或者杀掉占用80端口的进程,参照:centOS7杀死进程命令

  查看nginx的安装目录,并找到nginx.conf的目录:

rpm -ql grep nginx

  或者直接使用find命令查找 nginx.conf

(flaskApi) [root@67 flaskDemo]# find / -name nginx.conf
/etc/nginx/nginx.conf

  使用nano命令编辑nginx.conf配置文件,图示中2处默认为80的端口号改为81

nano /etc/nginx/nginx.conf

另外应当注意:

service nginx start 是centos6.x的命令 , centos7.x使用 systemctl start nginx

再次启动nginx,没看到启动成功的提示信息

(flaskApi) [root@67 flaskDemo]# /bin/systemctl start nginx.service

打印一下当前的进程,可以看到nginx已经启动了,并且使用的是81端口

参照文档:

Nginx修改默认端口80

nginx 在Centos 7 版本的yum安装 和目录解释

nginx启动报错的处理办法,参照:

https://blog.csdn.net/qq_40907977/article/details/91989353

centos7 ngxin启动失败:Job for nginx.service failed(80端口被占用的解决办法)的更多相关文章

  1. MySQL安装过程net start mysql 启动失败 报“错误2,系统找不到文件”的解决办法

    MySQL安装过程net start mysql 启动失败 报“错误2,系统找不到文件”的解决办法 错误2,系统找不到文件. 开始...运行... regedit  注册表项: HKEY_LOCAL_ ...

  2. apache无法正常启动,80端口被占用的解决方法

    apache无法正常启动,80端口被占用的解决方法 网上的方法: 仔细查看提示: make_sock: could not bind to address 0.0.0.0:80 恍然大悟,计算机上安装 ...

  3. 启用nginx报错80端口被占用

    最近在本机跑nginx,启动后报错,怀疑80端口被占用 netstat -ano|findstr 尝试一:查看后发现端口被一个System pid 为4的一个程序占用.我在资源管理器中尝试将Syste ...

  4. 启动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,安装完使用命令 service nignx restart  后,出现这个错误,并按照提示给出的命令查看错误详情  systemctl status nginx.service   ...

  5. docker 启动失败 Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

    CentOS7安装docker,安装成功后,启动失败 提示: 我们可以看到此处它提示是Failed to start Docker Application Container Engine. 于是在网 ...

  6. DOCKER启动失败Job for docker.service failed because the control process exited with error code. See "syste mctl status docker.service" and "journalctl -xe" for details.

    [root@localhost ~]# systemctl start docker Job for docker.service failed because the control process ...

  7. CentOS7端口被占用的解决办法

    1.根据端口号得到其占用的进程的详细信息 netstat -tlnp|grep 80tcp        0      0 192.168.33.10:80            0.0.0.0:*  ...

  8. Windows下启动ActiveMq端口被占用的解决办法

    cd /D E:\RuntimeSoft\apache-activemq-5.11.0\binactivemq.bat start结果提示:端口号被占用. Windows下查看端口号被占用开始--运行 ...

  9. centos7.2安装paramiko报error: command 'gcc' failed with exit status 1的解决办法

    安装依赖 yum install kernel-devel libxslt-devel libffi-devel python-devel mysql-devel zlib-devel openssl ...

随机推荐

  1. Solaris下truss的使用

    Solaris下truss的使用 原文转载:http://blog.csdn.net/sunlin5000/article/details/6560736 在Solaris下面,如果需要跟踪系统的调用 ...

  2. numpy中的argsort()函数

    在阅读<机器学习实战>一书中,发现了一个比较函数是argsort() 猜测是在numpy中出现的,手动进行了测试 >>> import numpy as np >& ...

  3. 问题:Thymeleaf整合Spring Security后sec属性不起作用

    可能原因: 版本不兼容,例如2.1.x的SpringBoot不兼容3.0.4的thymeleaf-extras-springsecurity4 解决方案: 修改Spring Boot的版本为2.0.x ...

  4. 53道Java线程面试题

    53道Java线程面试题 下面是Java线程相关的热门面试题,你可以用它来好好准备面试. 1) 什么是线程? 线程是操作系统能够进行运算调度的最小单位,它被包含在进程之中,是进程中的实际运作单位.程序 ...

  5. JS异常missing ) after argument list

    JS异常报错 missing ) after argument list 在使用JS拼接DOM元素时,有这种情况发生,'<a onclick="del(' + data.id + ') ...

  6. AIX查看系统日志

    1.查看系统启动日志 在AIX中可以使用alog命令来查看系统日志.   启动日志: /var/adm/ras/bootlog /var/adm/ras/bosinstlog /var/adm/ras ...

  7. 2017年全国卷3的21题与2018年全国卷3的21题命题背景是同一个函数$y=\frac{2x}{\ln(x+1)}$(再次瞎谈)

    2017年四川高考数学(全国卷3)理科21题第1问 已知函数\(f(x)=x-1-a\ln x\) (1)若\(f(x)\geqslant 0\),求\(a\)的值\(.\) 该不等式等价于$a\ln ...

  8. QT程序在发布的时候应注意的地方

    ---恢复内容开始--- 我们用QT开发好的应用程序,如果要发布到其他计算机上运行怎么办呢?我们在用VC编程时,单独运行编译好的可执行文件时,经常会发现提示缺少动态库.用QT编程也不例外,在一定程度上 ...

  9. Connection refused 排查过程

    Connection refused 排查过程 connection refused  排查  起因 今天在连接 rabbitmq 时,报 Connection refused (如下图),借此机会记 ...

  10. DevExpress WPF v19.1新版亮点:Data Editors等控件新功能

    行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPFv19.1中新增的一些控件及部分 ...