centos 7은 nginx를 시작할 수 없습니다

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를 설치했습니다.

답변1

@masegaloeh가 말했듯이 포트 80(이 경우 httpd)을 수신하는 또 다른 프로세스가 있습니다. 먼저 서비스를 중지해야 합니다(시작 시 비활성화할 수도 있음).

아파치를 중지하십시오.

systemctl stop httpd

부팅 시 Apache가 시작되는 것을 중지합니다.

systemctl disable httpd

관련 정보