Score:0

NGINX CentOS8 Server Block Configuration Issue

cf flag
Zek

I'm facing below issue when i need to activate server block from nginx.conf. Can you check it with me please?


sudo systemctl status nginx.service

● nginx.service - nginx - high performance web server

Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2022-10-21 18:28:13 +03; 11s ago Docs: http://nginx.org/en/docs/ Process: 8582 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE) Main PID: 2609 (code=exited, status=0/SUCCESS)

.....internal system[1]: Starting nginx - high performance web server... .....internal nginx[8582]: nginx: [emerg] bind() to 0.0.0.0:8085 failed (13: Permission denied) ....internal system[1]: nginx.service: Control process exited, code=exited status=1 ....internal system[1]: nginx.service: Failed with result 'exit-code'. ... Failed to start nginx - high performance web server.

Score:0
in flag

If you use a port bigger than 1024 with root privilege, but still got this problem, that's may be caused by SELinux. You can disable selinux and test.or give me permission for port.

Check this port, say 8085, in segange port

sudo semanage port -l | grep http_port_t

If 8085 doesn't exist in the port list, add it into segange port

sudo semanage port -a -t http_port_t  -p tcp 8085
Zek avatar
cf flag
Zek
Actually, I'm not using SELinux config from server.
Zek avatar
cf flag
Zek
conf file when it is configure with 8080 port nginx working btw . When i change port with 8081 or different value nginx isn't working.
Pandurang avatar
in flag
Sometimes your SELinux is disabled, you need to enforcing it first.
Zek avatar
cf flag
Zek
With above semanage config commands problem is solved. I activate semanage from server. Thank you
Pandurang avatar
in flag
could you please accept answer..
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.