如下
[root@localhost ~]# systemctl status nginx
● 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 Sun 2021-11-28 09:05:45 EST; 14s ago
Docs: http://nginx.org/en/docs/
Process: 2309 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Main PID: 1979 (code=exited, status=0/SUCCESS)
Nov 28 09:05:45 localhost.localdomain systemd[1]: Starting nginx - high performance web server...
Nov 28 09:05:45 localhost.localdomain nginx[2309]: nginx: [emerg] bind() to 0.0.0.0:6443 failed (13: Permissio
Nov 28 09:05:45 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Nov 28 09:05:45 localhost.localdomain systemd[1]: Failed to start nginx - high performance web server.
Nov 28 09:05:45 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Nov 28 09:05:45 localhost.localdomain systemd[1]: nginx.service failed.
解决办法
[root@localhost ~]# yum -y install policycoreutils-python.x86_64
[root@localhost ~]# semanage port -l | grep http_port_t
http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t tcp 5988
[root@localhost ~]# semanage port -a -t http_port_t -p tcp 6443
[root@localhost ~]# semanage port -l | grep http_port_t
http_port_t tcp 6443, 80, 81, 443, 488, 8008, 8009, 8443, 9000
[root@localhost ~]# systemctl start nginx
[root@localhost ~]# systemctl status nginx
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2021-11-28 09:11:38 EST; 4min 43s ago
Docs: http://nginx.org/en/docs/
Process: 2446 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 2447 (nginx)
CGroup: /system.slice/nginx.service
├─2447 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
├─2448 nginx: worker process
└─2449 nginx: worker process
Nov 28 09:11:38 localhost.localdomain systemd[1]: Starting nginx - high performance web server...
Nov 28 09:11:38 localhost.localdomain systemd[1]: Started nginx - high performance web server.
端口小于1024 sudo nginx