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端口被占用
直接在nginx-1.22.0\conf目录下的nginx.conf中找到serve
如图所示:
还有一种情况,双击nginx,窗口闪一下,但nginx就是起不来。也是端口被占用。也没有任何提示。
如图所示:
你会看到:10013: An attempt was made to access a socket in a way forbidden by its access permissions,这也是端口被占用了。
我们可以用命令查找占用的端口
1首先win+R打开命令提示符窗口,输入cmd;
2输入netstat -ano | findstr “80”
如图可以看到确实被占用
3从任务管理器找到被占用进程的PID为4.我们把它强制停止
如图
但是我这个被系统占用,杀不死,只能去改端口。