在nginx设置基于端口的虚拟主机的时候,设定两个端口,一个是80,一个是8090, 在重启nginx的时候
[root@zmedu-17 rpm]# systemctl restart nginxJob for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service "journalctl -xe" for details.
查看日志:[root@zmedu-17 rpm]# vim /var/log/nginx/error.log
发现如下错误信息:
2020/07/31 10:57:59 [warn] 67866#67866: conflicting server name "" on 0.0.0.0:80, ignored2020/07/31 11:00:57 [emerg] 68067#68067: bind() to 0.0.0.0:8090 failed (13: Permission denied)
一般这种情况都是因为防火墙或者selinux限制
设置selinux:[root@zmedu-17 rpm]# setenforce 0[root@zmedu-17 rpm]# getenforce Permissive
设置完selinux之后再次重试
[root@zmedu-17 rpm]# systemctl restart nginx 运行成功,而且没有报错,
问题解决