您现在的位置是:首页 >技术杂谈 >Windows下启动nginx报错: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket网站首页技术杂谈

Windows下启动nginx报错: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket

不学无术BruceYoung 2024-06-17 10:19:56
简介Windows下启动nginx报错: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket

启动nginx

(方法1)直接双击nginx.exe,双击后一个黑色的弹窗一闪而过

(方法2)打开cmd命令窗口,切换到nginx解压目录下,输入命令 nginx.exe 或者 start 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)

解决方案1:

1.nginx默认端口为80,输入netstat -aon|findstr :80,找到端口号为0.0.0.0:80被占用了,查看pid值为4

2.输入tasklist|findstr  "4",找到4端口对应的名称,为 System 

3.查看后是System系统占用无法手动终止,原因是SQLServer Reporting Services,停掉这个服务并设置为手动起动即可,启动好nginx后,需重新启动SQLServer Reporting Services

缺点:这种做法每次开机后需重新停掉SQLServer Reporting Services,再启动nginx 

解决方案二:

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

2.按键盘win+r,输入cmd,打开管理员界面,输入netstat -aon|findstr :8888,查看8888端口号是否被占用,没有占用则没有输出。

3.修改nginx.conf,后保存

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

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

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

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。