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

Sagar picture Sagar · Sep 20, 2016 · Viewed 46.7k times · Source

I am trying to run Nginx, but I am getting the error below:

bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)

Please provide some help on what changes I need to do to make it working?

I have tried running on ports other than 80 and it works. but I need it to be running on 80.

Note: I am running on Windows 7 with command prompt running as Administrator.

Answer

Daniel Treiber picture Daniel Treiber · Feb 10, 2017

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.