centos7 ngxin启动失败:Job for nginx.service failed(80端口被占用的解决办法)
问题描述:
(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 在Centos 7 版本的yum安装 和目录解释
nginx启动报错的处理办法,参照:
https://blog.csdn.net/qq_40907977/article/details/91989353
centos7 ngxin启动失败:Job for nginx.service failed(80端口被占用的解决办法)的更多相关文章
- MySQL安装过程net start mysql 启动失败 报“错误2,系统找不到文件”的解决办法
MySQL安装过程net start mysql 启动失败 报“错误2,系统找不到文件”的解决办法 错误2,系统找不到文件. 开始...运行... regedit 注册表项: HKEY_LOCAL_ ...
- apache无法正常启动,80端口被占用的解决方法
apache无法正常启动,80端口被占用的解决方法 网上的方法: 仔细查看提示: make_sock: could not bind to address 0.0.0.0:80 恍然大悟,计算机上安装 ...
- 启用nginx报错80端口被占用
最近在本机跑nginx,启动后报错,怀疑80端口被占用 netstat -ano|findstr 尝试一:查看后发现端口被一个System pid 为4的一个程序占用.我在资源管理器中尝试将Syste ...
- 启动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 ...
- 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. 于是在网 ...
- 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 ...
- CentOS7端口被占用的解决办法
1.根据端口号得到其占用的进程的详细信息 netstat -tlnp|grep 80tcp 0 0 192.168.33.10:80 0.0.0.0:* ...
- Windows下启动ActiveMq端口被占用的解决办法
cd /D E:\RuntimeSoft\apache-activemq-5.11.0\binactivemq.bat start结果提示:端口号被占用. Windows下查看端口号被占用开始--运行 ...
- 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 ...
随机推荐
- 手把手带你了解sass
sass的使用 减少重复的工作 1.变量的声明: 是以$开头给变量命名; $height-color: #F30 2.变量的使用范围: 变量可以在多个地方存在,不一定限制在代码块中.但是如果定义在了代 ...
- 012-zabbix主动模式
6.1 主动模式 zabbix agent检测分为主动(agent active)和被动(agent)两种形式,主动与被动的说法均是相对于agent来讨论的.简单说明一下主动与被动的区别如下: 主动: ...
- qt常用技巧
发布程序:windeployqt hello.exe QString乱码问题,在字符串前加u8
- yum安装nginx服务
配置yum源 官网更新源地址:nginx 添加到 yum.repos.d 中 vim /etc/yum.repos.d/nginx.repo [nginx-stable] name=nginx sta ...
- 【ZJOI2009】狼和羊的故事
题目 "狼爱上羊啊爱的疯狂,谁让他们真爱了一场:狼爱上羊啊并不荒唐,他们说有爱就有方向......" Orez听到这首歌,心想:狼和羊如此和谐,为什么不尝试羊狼合养呢?说干就干! ...
- 两句话掌握 Python 最难知识点——元类
千万不要被所谓“元类是99%的python程序员不会用到的特性”这类的说辞吓住.因为每个中国人,都是天生的元类使用者 学懂元类,你只需要知道两句话: 道生一,一生二,二生三,三生万物 我是谁?我从哪来 ...
- lazarus for win32 serviceApp
procedure TMyThread.Execute; begin //Application.EventLog.FileName:='d:\xx.txt'; //Application.Event ...
- 工作笔记--js-点赞按钮和踩踩按钮互斥??怎么写?
效果图: html: css: .an{ margin-top:0px; position: relative; .popzframe,.popcframe{ display: none; word- ...
- js-展开评论与隐藏评论
//控制展开评论和隐藏评论 controldiscuss(){ $(".opendiss").click(function(){ if($(this).context.innerH ...
- net core 返回值
//指定类下的子类 Type helloType = typeof(ActionResult); List<Type> types = new List<Type>(); fo ...