Home >Operation and Maintenance >Nginx >Does nginx require root to install?
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 ACCEPTSave and exit
sudo service iptables restart//重启防火墙2.Open the web port
firewall-cmd --permanent --add-port=10000/tcpRestart firewall
firewall-cmd –reload3.Or close the firewall systemctl stop firewalld
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!