ngnix启动时80端口被pid为4的system进程占用80端口的解决办法

1、最近使用了WebDeploy时,又想搞个ngnix进行负载均衡,但是发现ngnix启动失败,报以下错误:

[emerg] 4752#4680: 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下的ngnix安装见https://www.cnblogs.com/edward2013/p/5506588.html

2、通过 在命令行中输入 netstat -aon|findstr "80" ,发现pid的值为4此进程为系统进程,尝试了各种方法将iis服务关闭都不行,结果后来查到是和系统的下图服务有冲突

3、通过查找资料,操作步骤如下

1、停止WebDeploy服务

  停止"Web Deployment Agent Service"服务 (net stop msdepsvc)

2、修改注册表

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MsDepSvc\Parameters\ListenUrl

修改前:http://+:80/MsDeployAgentService

修改后:http://+:8172/MsDeployAgentService

3、修改地址

Windows XP,Windows Server 2003以下服务器运行如下命令:

httpcfg query urlacl

httpcfg delete urlacl /u http://+:80/MsDeployAgentService/

httpcfg set urlacl /u http://+:8171/MsDeployAgentService/ /a D:(A;;GX;;;NS)

Windows Vista,Windows Server 2008以上服务器运行如下命令:

etsh http show urlacl

netsh http delete urlacl url=http://+:80/MSDEPLOYAGENTSERVICE/

netsh http add urlacl url=http://+:8171/MSDEPLOYAGENTSERVICE/ sddl=D:(A;;GX;;;NS)

4、启动WebDeploy服务

启动"Web Deployment Agent Service"服务 (net start msdepsvc)

5、最终ngnix服务可以启动了


注:参考地址https://www.cnblogs.com/VAllen/archive/2018/01/11/Web-Deploy-Failed.html

你可能感兴趣的:(ngnix启动时80端口被pid为4的system进程占用80端口的解决办法)