nginx failed to start (bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket...permissions)

nginx failed to start, the port is occupied

nginx启动失败(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))

After Windows installed, nginx failed to start, and the error nginx: [emerg] 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) was reported as nginx
insert image description here
listen Port 80 is occupied

  1. cmd input command netstat -aon|findstr "80"
    to open cmd

Enter the command: netstat -aon|findstr "80" to query who occupies port 80

C:\Users\x1c netstat -aon|findstr "80"

 TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 7532

 TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 4780

 TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 4780

 TCP 0.0.0.0:6800 0.0.0.0:0 LISTENING 10844

 TCP 0.0.0.0:8082 0.0.0.0:0 LISTENING 12892

 TCP 127.0.0.1:10808 0.0.0.0:0 LISTENING 13880

2. View the tasks corresponding to port 80 7532

Enter the command: tasklist|findstr "7532"

C:\Users\x1c tasklist|findstr "7532"
nginx.exe 7532 Console 1 7,440 K

It turns out that I opened the nginx program before and took up port 80, then turn it off.
3. End the corresponding task.
insert image description here
End task 7532.
4. Start nginx
, open cmd, go to the corresponding nginx directory, start nginx, and it can start successfully.

5. If the pid corresponding to port 80 is 4, then port 80 is occupied by System, usually IIS service or sqlServerService service. I encountered the situation of IIS service occupation.

C:\Users\x1c netstat -aon|findstr "80"

 TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4

 TCP 0.0.0.0:902 0.0.0.0:0 LISTENING 4780

 TCP 0.0.0.0:912 0.0.0.0:0 LISTENING 4780

 TCP 0.0.0.0:6800 0.0.0.0:0 LISTENING 10844

 TCP 0.0.0.0:8082 0.0.0.0:0 LISTENING 12892

 TCP 127.0.0.1:6804 127.0.0.1:3462 TIME_WAIT 0

 TCP 127.0.0.1:10808 0.0.0.0:0 LISTENING 13880

 TCP 192.168.124.12:6135 221.181.72.102:80 CLOSE_WAIT 15692
C:\Users\x1c tasklist|findstr "80"

smss.exe 380 Services 0 708 K

csrss.exe 580 Services 0 3,508 K

svchost.exe 888 Services 0 32,580 K

winlogon.exe 880 Console 1 7,164 K

LPlatSvc.exe 1780 Services 0 4,236 K

ibmpmsvc.exe 1796 Services 0 4,080 K

igfxCUIService.exe 2300 Services 0 5,380 K

svchost.exe 2800 Services 0 7,188 K

svchost.exe 3284 Console 1 16,808 K

vmware-authd.exe 4780 Services 0 8,056 K

This may be that the IIS service occupies port 80, so try to close the IIS service.

Start the IIS service net start w3svc

Close the IIS service net stop w3svc

run cmd as administrator,

Enter the command net stop w3svc
insert image description here
to close the IIS service, then you can try to start nginx to see if IIS occupies port 80.
insert image description here
You can execute nginx.exe, that is, IIS occupies port 80. Then restart IIS on it.

Guess you like

Origin blog.csdn.net/zch981964/article/details/127318302