When started with non-root permissions, nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) error will appear.
Reason: Only root users in Linux can use ports below 1024 (Recommended learning: nginx tutorial)
Solution Method:
1. Start with root privileges
2. Change port 80 in the nginx.conf file to above 1024
Verify nginx installation Started successfully:
sbin/nginx -v View version
##View the page according to the configured IP:
Note: If there is a firewall configured and the nginx service cannot be accessed through the web after it is opened, you can try the following solutions (for example, the port number is 10000):
1 .Open the firewall filesudo vim /etc/sysconfig/iptables //新增行 开放10000端口 -A INPUT -p tcp -m state --state NEW -m tcp --dport 10000 -j ACCEPT
sudo service iptables restart//重启防火墙
firewall-cmd --permanent --add-port=10000/tcp
firewall-cmd –reload
The above is the detailed content of Does nginx require root to install?. For more information, please follow other related articles on the PHP Chinese website!