oec-hardware-server启动nginx报错的解决方法

启动nginx server时,报告如下错误,启动失败:
[root@localhost ~]# systemctl start oech-server.service
[root@localhost ~]# systemctl start nginx.service
Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xeu nginx.service” for details.
[root@localhost ~]# systemctl status nginx.service
× 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 Mon 2024-05-13 12:42:54 CST; 9s ago
Process: 6697 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 6699 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)

May 13 12:42:54 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server…
May 13 12:42:54 localhost.localdomain nginx[6699]: nginx: [emerg] open() “/etc/nginx/default.d/uwsgi.conf” failed (13: Permission denied) in /etc/nginx/nginx.conf:45
May 13 12:42:54 localhost.localdomain nginx[6699]: nginx: configuration file /etc/nginx/nginx.conf test failed
May 13 12:42:54 localhost.localdomain systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 13 12:42:54 localhost.localdomain systemd[1]: nginx.service: Failed with result ‘exit-code’.
May 13 12:42:54 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

从网络上搜索解决方法,改权限,改所属用户组, 卸载重装相关软件都没有解决,最后执行如下命令后,再启动nginx就能成功,具体原因不详,先记录下供大家参考:
systemctl stop firewalld
iptables -F
setenforce 0
上面的三条命令也就是oec-hareware文档中的第三步要执行的命令,但不知道为什么必须要放到第二步才能成功。猜测是selinux开启导致的权限问题,而setenforce 0是关闭selinux.