启动Nginx服务失败,错误日志如下,请老师帮忙看下是什么原因?

来源:7-3 Nginx的基本操作

刘大鱼

2019-05-09

[root@www yum]# systemctl status nginx
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 四 2019-05-09 19:07:29 CST; 43s ago
     Docs: http://nginx.org/en/docs/
  Process: 3593 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

5月 09 19:07:26 www.apachetest.com nginx[3593]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
5月 09 19:07:27 www.apachetest.com nginx[3593]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
5月 09 19:07:27 www.apachetest.com nginx[3593]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
5月 09 19:07:28 www.apachetest.com nginx[3593]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
5月 09 19:07:28 www.apachetest.com nginx[3593]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
5月 09 19:07:29 www.apachetest.com systemd[1]: nginx.service: control process exited, code=exited status=1
5月 09 19:07:29 www.apachetest.com nginx[3593]: nginx: [emerg] still could not bind()
5月 09 19:07:29 www.apachetest.com systemd[1]: Failed to start nginx - high performance web server.
5月 09 19:07:29 www.apachetest.com systemd[1]: Unit nginx.service entered failed state.
5月 09 19:07:29 www.apachetest.com systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

倒数第4行和倒数第6行是报错加粗的部分。

写回答

1回答

编程浪子

2019-05-09

你好

bind() to 0.0.0.0:80 failed (98: Address alr...use)

说明已经有个服务已经占用了80端口。

 执行 如下命令看谁占用了

netstat -anpl |grep 80  

1
1
刘大鱼
感谢,是httpd服务忘了关了,关掉httpd服务再启动就OK了
2019-05-10
共1条回复

快速上手Linux 玩转典型应用

以主流CentOS 7 操作系统为例,系统讲解Linux,真实线上环境助你快速上手,独立配置运维服务器

1663 学习 · 572 问题

查看课程