启动失败,定制网站定制网站端口被占用
nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a 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端口被占用
- 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
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
2.、查看80端口 7532对应的任务
输入命令: tasklist|findstr “7532”
C:\Users\x1c tasklist|findstr "7532"nginx.exe 7532 Console 1 7,440 K
- 1
- 2
原来是我之前打开过nginx程序占用了80端口,那就去关掉
3、结束对应任务
结束任务7532.
4、去启动nginx
打开cmd,去对应的nginx目录,启动nginx,可以启动成功。
5、如果80端口对应的pid是4,那么80端口是 被System 占用了,一般是服务或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
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
C:\Users\x1c tasklist|findstr "80"smss.exe 380 Services 0 708 Kcsrss.exe 580 Services 0 3,508 Ksvchost.exe 888 Services 0 32,580 Kwinlogon.exe 880 Console 1 7,164 KLPlatSvc.exe 1780 Services 0 4,236 Kibmpmsvc.exe 1796 Services 0 4,080 KigfxCUIService.exe 2300 Services 0 5,380 Ksvchost.exe 2800 Services 0 7,188 Ksvchost.exe 3284 Console 1 16,808 Kvmware-authd.exe 4780 Services 0 8,056 K
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
这个有可能是 IIS服务 占用80端口 ,那就去尝试关闭IIS服务。
启动IIS服务 net start w3svc
关闭IIS服务 net stop w3svc
以管理员身份运行cmd,
输入命令net stop w3svc
关闭IIS服务了,那就可以去尝试启动下nginx,看是否是IIS占用了80端口
可以执行nginx.exe 那就是IIS占用了80端口。然后再重启IIS就可以了。