Nginx- error: bind() to 0.0.0.0:80 failed. permission denied Nginx- error: bind() to 0.0.0.0:80 failed. permission denied nginx nginx

Nginx- error: bind() to 0.0.0.0:80 failed. permission denied


If the port is already in use, you can change the default port of 80 to a different port that is not in use (maybe 8070). In conf\nginx.conf:

server {    listen       8070;    ...}

After startup, you should be able to hit localhost:8070.


tl;dr

netsh http add iplisten ipaddress=::

Faced similar issue. Run the above command in command prompt.
This should free up port 80, and you'd be able to run nginx.

Description:
netsh http commands are used to query and configure HTTP.sys settings and parameters.

add iplisten :Adds a new IP address to the IP listen list, excluding the port number.
"::" means any IPv6 address.

For more netsh http commands refer the netsh http commands documentation.

Hope this helps!!


You have to be admin or root to bind port 80. Something you can do if you cannot run as root, is that your application listens to other port, like 8080, and then you redirect messages directed to 80 to 8080. If you are using Linux you redirect messages with iptables.