无法在centos 7上启动nginx

service Nginx start
Redirecting to /bin/systemctl start  Nginx.service
Job for Nginx.service Failed. See 'systemctl status Nginx.service' and 'journalctl -xn' for details.

[root@myvps ~]# systemctl status Nginx.service
Nginx.service - The Nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/Nginx.service; disabled)
   Active: Failed (Result: exit-code) since Tue 2014-12-23 03:48:02 EST; 10s ago
  Process: 19895 ExecStart=/usr/sbin/Nginx (code=exited, status=1/FAILURE)
  Process: 19892 ExecStartPre=/usr/sbin/Nginx -t (code=exited, status=0/SUCCESS)

Dec 23 03:48:00 myvps Nginx[19892]: Nginx: configuration file /etc/Nginx...ul
Dec 23 03:48:00 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 ...e)
Dec 23 03:48:00 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 ...e)
Dec 23 03:48:01 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 ...e)
Dec 23 03:48:01 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 ...e)
Dec 23 03:48:02 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 ...e)
Dec 23 03:48:02 myvps Nginx[19895]: Nginx: [emerg] still Could not bind()
Dec 23 03:48:02 myvps systemd[1]: Nginx.service: control process exited,...=1
Dec 23 03:48:02 myvps systemd[1]: Failed to start The Nginx HTTP and rev...r.
Dec 23 03:48:02 myvps systemd[1]: Unit Nginx.service entered Failed state.
Hint: Some lines were ellipsized, use -l to show in full.

[root@myvps ~]# journalctl -xn
-- Logs begin at Mon 2014-12-22 15:26:47 EST, end at Tue 2014-12-23 03:48:02 EST
Dec 23 03:48:00 myvps Nginx[19892]: Nginx: configuration file /etc/Nginx/ngin
Dec 23 03:48:00 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 faile
Dec 23 03:48:00 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 faile
Dec 23 03:48:01 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 faile
Dec 23 03:48:01 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 faile
Dec 23 03:48:02 myvps Nginx[19895]: Nginx: [emerg] bind() to 0.0.0.0:80 faile
Dec 23 03:48:02 myvps Nginx[19895]: Nginx: [emerg] still Could not bind()
Dec 23 03:48:02 myvps systemd[1]: Nginx.service: control process exited, code
Dec 23 03:48:02 myvps systemd[1]: Failed to start The Nginx HTTP and reverse 
-- Subject: Unit Nginx.service has Failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit Nginx.service has Failed.
-- 
-- The result is Failed.
Dec 23 03:48:02 myvps systemd[1]: Unit Nginx.service entered Failed state.

和/ lib / systemd / system / Nginx-service

[Unit]
Description=The Nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

    [Service]
    Type=forking
    PIDFile=/run/Nginx.pid
    ExecStartPre=/usr/sbin/Nginx -t
    ExecStart=/usr/sbin/Nginx
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true

    [Install]
    WantedBy=multi-user.target

Nginx -t
Nginx: the configuration file /etc/Nginx/Nginx.conf Syntax is ok
Nginx: configuration file /etc/Nginx/Nginx.conf test is successful

netstat -tulpn
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:3306            0.0.0.0:*               LISTEN      17005/MysqLd        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      769/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      772/sendmail: accep 
tcp6       0      0 :::80                   :::*                    LISTEN      1373/httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      769/sshd            

我使用Epel 7.5在我的centos 7 64位上安装了Nginx-1.6.2-4.el7.x86_64

解决方法:

正如@masegaloeh所说,你有另一个进程侦听端口80,在这种情况下是httpd.您需要先停止该服务(并且可能希望在启动时禁用它).

停止Apache;

systemctl stop httpd

在启动时停止Apache启动;

systemctl disable httpd

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...