查看错误日志:
// 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 Fri 2017-10-27 14:54:02 CST; 24s ago
// Docs: http://nginx.org/en/docs/
// Process: 18084 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
// Process: 18083 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
// Oct 27 14:54:01 iz2ze4xcr61yxdtpdmxspzz nginx[18084]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address...use)
// Oct 27 14:54:01 iz2ze4xcr61yxdtpdmxspzz nginx[18084]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Addres...use)
// Oct 27 14:54:01 iz2ze4xcr61yxdtpdmxspzz nginx[18084]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address...use)
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz nginx[18084]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Addres...use)
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz nginx[18084]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address...use)
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz systemd[1]: nginx.service: control process exited, code=exited status=1
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz nginx[18084]: nginx: [emerg] still could not bind()
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz systemd[1]: Failed to start nginx - high performance web server.
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz systemd[1]: Unit nginx.service entered failed state.
// Oct 27 14:54:02 iz2ze4xcr61yxdtpdmxspzz systemd[1]: nginx.service failed.
netstat -ntlp
百度查询是端口443 和8080 被占用
使用命令关闭占用8080 443端口的程序
sudo fuser -k 80/tcp
sudo fuser -k 443/tcp
再次重启 systemctl restart nginx.service
查看当前nginx状态 systemctl status nginx.service
网友评论