我正在使用此命令启动Nginx:sudo systemctl start nginx
,但是我收到此错误:
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2018-03-21 17:42:36 MSK; 2min 59s ago
Process: 27647 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 27644 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 27641 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru nginx[27647]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru nginx[27647]: nginx: [emerg] still could not bind()
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: nginx.service: control process exited, code=exited status=1
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: Unit nginx.service entered failed state.
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: nginx.service failed.
我查了80端口:
[habrauser@ovz1 system]$ netstat -na | grep ".80"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
有什么想法吗?谢谢
答案 0 :(得分:0)
将-p添加到netstat,如下所示:sudo netstat -na -p | grep ".80"
它会为您提供kill
进程的pid。
然后尝试sudo systemctl start nginx
,对我来说它运作正常。
允许防火墙端口sudo firewall-cmd --zone=public --add-port=80/tcp