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 ...
随机推荐
- linux下mysql的常用命令
更改mysql数据库root的密码 首次进入数据库是不用密码的: [root@localhost ~]# /usr/local/mysql/bin/mysql -uroot Welcome to th ...
- redis之使用场景
随着数据量的增长,MySQL 已经满足不了大型互联网类应用的需求.因此,Redis 基于内存存储数据,可以极大的提高查询性能,对产品在架构上很好的补充.在某些场景下,可以充分的利用 Redis 的特性 ...
- 日语能力测试N1、N2级听力必备核心词汇—头发篇
日语能力测试N1.N2级听力必备核心词汇—头发篇 要想在短时间内迅速提高日语听力能力的水平,除了每天练习(用2倍的速度)真题之外,掌握听力的核心词汇也是一个必要的好方法. 髪(かみ)--头发髪型(かみ ...
- ios UICollectionView 加载数据后 滑动卡顿问题
最近项目的资源图片变大了,滑动时总是卡顿,在这里用NSOperationQueue解决了一下 .h 文件 @interface CollectionViewCell : UICollectionVie ...
- 2019牛客暑期多校训练营(第一场) A Equivalent Prefixes ( st 表 + 二分+分治)
链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Equivalent Prefixes 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/ ...
- VS2013 删除"附加依赖项"中“继承的值”
经过好几次尝试,都无法在VS2013中直接删除“继承的值”,于是另辟蹊径,找到了一种解决方法. 相对而言,在 VS2010 中干这件事会容易一点,或者说,成功率更高一点,于是,我的思路就是再装一个 V ...
- ARM仿真器之驱动黄色惊叹号
JLink CDC UART PORT 黄色惊叹号 Windows 无法验证此设备所需的驱动程序的数字签名.某软件或硬件最近有所更改,可能安装了签名错误或损毁的文件,或者安装的文件可能是来路不明的恶意 ...
- conda Pyhon版本切换
1.首先确保你的系统里已经安装了Conda,打开命令行窗口,执行命令:conda --version 2.查看你的系统当前已有的Python环境,执行命令:conda info --envs,从图中我 ...
- 错误:The selected wizard could not be started Plug-in com.genuitec.eclipse.j2ee.ui was unable to load class com.genuitec.eclipse.j2ee.ui.wizard.WebProjectWizard
错误:The selected wizard could not be started Plug-in com.genuitec.eclipse.j2ee.ui was unable to load ...
- 【leetcode】1224. Maximum Equal Frequency
题目如下: Given an array nums of positive integers, return the longest possible length of an array prefi ...