Home >Operation and Maintenance >Nginx >Does nginx require root to install?

Does nginx require root to install?

(*-*)浩
(*-*)浩Original
2019-11-01 13:22:165869browse

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

Does nginx require root to install?

##View the page according to the configured IP:

Does nginx require root to install?

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 file

sudo vim /etc/sysconfig/iptables
//新增行  开放10000端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10000 -j ACCEPT

Save and exit

sudo service iptables restart//重启防火墙

2.Open the web port

firewall-cmd --permanent --add-port=10000/tcp

Restart firewall

firewall-cmd –reload

3.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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn