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、結束對應任務
結束任務7532.
4、去啟動nginx
打開cmd,去對應的nginx目錄,啟動nginx
瀏覽器輸入localhost
啟動成功
或者是 System 占用的80端口
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 start w3svc
以管理員身份運行cmd,
輸入命令net start w3svc
關閉IIS服務了,那就可以去嘗試啟動下nginx,看是否是IIS占用了80端口
可以執行nginx.exe 那就是IIS占用了80端口。