nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket…permissions)

nginx启动失败,端口被占用

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))

在Windows安装了下nginx启动失败,报错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)
在这里插入图片描述
原来是nginx listen的80端口被占用

  1. cmd输入命令netstat -aon|findstr “80”
    打开cmd

输入命令: netstat -aon|findstr “80” 查询谁占了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.、查看80端口 7532对应的任务

输入命令: tasklist|findstr “7532”

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

原来是我之前打开过nginx程序占用了80端口,那就去关掉
3、结束对应任务
nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket…permissions)_第1张图片
结束任务7532.
4、去启动nginx
打开cmd,去对应的nginx目录,启动nginx,可以启动成功。

5、如果80端口对应的pid是4,那么80端口是 被System 占用了,一般是IIS服务或sqlServerService服务占用,我遇到的是IIS服务占用情况。

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

这个有可能是 IIS服务 占用80端口 ,那就去尝试关闭IIS服务。

启动IIS服务 net start w3svc

关闭IIS服务 net stop w3svc

以管理员身份运行cmd,

输入命令net stop w3svc
nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket…permissions)_第2张图片
关闭IIS服务了,那就可以去尝试启动下nginx,看是否是IIS占用了80端口
nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket…permissions)_第3张图片
可以执行nginx.exe 那就是IIS占用了80端口。然后再重启IIS就可以了。

你可能感兴趣的:(其他,nginx,服务器,网络)