【报错】Windows下启动nginx报:bind() to 0.0.0.0:80 failed...

文章目录

报错

Windows下启动nginx报:bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket
在这里插入图片描述

分析

查看nginx-1.19.2\logs目录下的error.log,得知报错信息为: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)

(2)按键盘win+r,输入cmd,打开管理员界面

(3)输入netstat -aon|findstr :80,找到端口号为0.0.0.0:80被占用了,查看pid值为4
在这里插入图片描述

(4)输入tasklist|findstr “4”,找到4端口对应的名称,为 System

在这里插入图片描述

解决

修改nginx.conf下的默认端口号

(1)用记事本打开nginx目录下的nginx.conf文件

(2)按键盘win+r,输入cmd,打开管理员界面,输入netstat -aon|findstr :预期端口号,查看自己的预期端口号是否被占用

(3)修改nginx.conf,后保存
在这里插入图片描述

(4)在命令提示符下输入nginx -s reload即可(重要一步)

(5)然后命令提示符下输入start nginx

(6)在浏览器localhost:81,如果出现以下页面在修改成功

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_53810245/article/details/126766486