如何释放本地 Windows 上的 80 端口?

发布于 2024-07-18 16:26:55 字数 90 浏览 8 评论 0原文

我安装了 XAMPP 1.6.8,但由于某种原因它不起作用。 后来发现80端口没有空闲或者没有监听。 我怎样才能释放它或使其免费?

多谢!

I installed XAMPP 1.6.8 and for some reason it didn't work. Later realized port 80 is not free or not listening. How can I release it or make it free?

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(18

请别遗忘我 2024-07-25 16:26:56

侦听端口 80 的已知 Windows 服务

从服务管理器(运行:services.msc)中,停止并禁用这些已知绑定到端口 80 的 Windows 服务。

双击服务,并将“启动类型”更改为“禁用”...

  1. SQL服务器 Reporting Services (ReportServer)
  2. Web 部署代理服务 (MsDepSvc)
  3. BranchCache (PeerDistSvc)
  4. 同步共享服务 (SyncShareSvc)
  5. 万维网发布服务 (W3SVC)
  6. Internet 信息服务器(WAS、IISADMIN)

skype 也使用端口 80 作为默认设置,您可以取消选中它。

您可能安装并运行了其中一些服务,也可能没有。

在我的例子中,“SQL Server Reporting Services”正在打开端口 80。

Known Windows Services That Listen on Port 80

From Services Manager (run: services.msc), stop and disable these Windows Services which are known to bind to port 80.

Double click Service, and change ‘Startup Type’ to ‘Disabled’…

  1. SQL Server Reporting Services (ReportServer)
  2. Web Deployment Agent Service (MsDepSvc)
  3. BranchCache (PeerDistSvc)
  4. Sync Share Service (SyncShareSvc)
  5. World Wide Web Publishing Service (W3SVC)
  6. Internet Information Server (WAS, IISADMIN)

skype also using port 80 as default setting and you can uncheck it.

You might, or might not, have some of these Services installed and running.

In my case "SQL Server Reporting Services" was opening port 80.

口干舌燥 2024-07-25 16:26:56

以编程方式识别真实进程

(当进程 ID 显示为 4 时)

这里的答案与往常一样,期望一定程度的交互性。

问题是当某些东西通过 HTTP.sys 监听时; 然后,PID 始终为 4,并且正如大多数人发现的那样,您需要一些工具来找到真正的所有者。

以下是如何以编程方式识别有问题的进程。 没有 TcpView 等(与这些工具一样好)。 是否依赖netsh; 但问题通常与 HTTP.sys 有关。

$Uri = "http://127.0.0.1:8989"    # for example


# Shows processes that have registered URLs with HTTP.sys
$QueueText = netsh http show servicestate view=requestq verbose=yes | Out-String

# Break into text chunks; discard the header
$Queues    = $QueueText -split '(?<=\n)(?=Request queue name)' | Select-Object -Skip 1

# Find the chunk for the request queue listening on your URI
$Queue     = @($Queues) -match [regex]::Escape($Uri -replace '/

最初发布于此处:https://stackoverflow.com/a/65852847/6274530

) if ($Queue.Count -eq 1) { # Will be null if could not pick out exactly one PID $ProcessId = [string]$Queue -replace '(?s).*Process IDs:\s+' -replace '(?s)\s.*' -as [int] if ($ProcessId) { Write-Verbose "Identified process $ProcessId as the HTTP listener. Killing..." Stop-Process -Id $ProcessId -Confirm } }

最初发布于此处:https://stackoverflow.com/a/65852847/6274530

Identify the real process programmatically

(when the process ID is shown as 4)

The answers here, as usual, expect a level of interactivity.

The problem is when something is listening through HTTP.sys; then, the PID is always 4 and, as most people find, you need some tool to find the real owner.

Here's how to identify the offending process programmatically. No TcpView, etc (as good as those tools are). Does rely on netsh; but then, the problem is usually related to HTTP.sys.

$Uri = "http://127.0.0.1:8989"    # for example


# Shows processes that have registered URLs with HTTP.sys
$QueueText = netsh http show servicestate view=requestq verbose=yes | Out-String

# Break into text chunks; discard the header
$Queues    = $QueueText -split '(?<=\n)(?=Request queue name)' | Select-Object -Skip 1

# Find the chunk for the request queue listening on your URI
$Queue     = @($Queues) -match [regex]::Escape($Uri -replace '/

Originally posted here: https://stackoverflow.com/a/65852847/6274530

) if ($Queue.Count -eq 1) { # Will be null if could not pick out exactly one PID $ProcessId = [string]$Queue -replace '(?s).*Process IDs:\s+' -replace '(?s)\s.*' -as [int] if ($ProcessId) { Write-Verbose "Identified process $ProcessId as the HTTP listener. Killing..." Stop-Process -Id $ProcessId -Confirm } }

Originally posted here: https://stackoverflow.com/a/65852847/6274530

微暖i 2024-07-25 16:26:56

我遇到了同样的问题,并通过在 httpd.conf 文件中进行一些小的更改来修复它,该文件可以通过单击配置按钮和 Apache 选项来获得。

我所做的更改是将listen 80 替换为listen 8080。

I faced the same issue and fixed it by making a small change in the httpd.conf file which can be obtained by clicking the config button along with the Apache option.

The change I made was to replace listen 80 with listen 8080.

三生池水覆流年 2024-07-25 16:26:56

对于我来说,当我在 Windows 8 计算机上托管 VPN 连接时,这个问题就开始出现了。

只需从“控制面板\网络和 Internet\网络连接”中删除连接即可解决问题。

For me, this problem began when I hosted a VPN-connection on my Windows 8 computer.

Simply deleting the connection from "Control Panel\Network and Internet\Network Connections" solved the problem.

微暖i 2024-07-25 16:26:55

我发现接管80端口的是http api服务。 我在cmd中写道:

net stop http

问我“以下服务将被停止,是否要继续?” 按 y

它实际上停止了许多服务。

然后写入 localhost 和 wallah,Apache 已启动并在端口 80 上运行。

重要:Skype 默认使用端口 80,您可以在 Skype 选项 > 中更改此设置。 高级> 连接 - 并取消选中“使用端口 80”

I found out that what was taking over port 80 is http api service. I wrote in cmd:

net stop http

Asked me "The following services will be stopped, do you want to continue?" Pressed y

It stopped a number of services actually.

Then wrote localhost and wallah, Apache is up and running on port 80.

Important: Skype uses port 80 by default, you can change this in skype options > advanced > connection - and uncheck "use port 80"

遮云壑 2024-07-25 16:26:55

netstat -ano

这将显示正在侦听端口 80 的进程的 PID。
之后,打开任务管理器-> 进程选项卡。 从查看 -> 选择Columns菜单,启用PID列,您将看到侦听端口80的进程的名称。

netstat -ano

That will show you the PID of the process that is listening on port 80.
After that, open the Task Manager -> Processes tab. From the View -> Select Columns menu, enable the PID column, and you will see the name of the process listening on port 80.

郁金香雨 2024-07-25 16:26:55

我以前遇到过这个问题,

如果你看到任务管理器(启用PID视图后),你会发现PID=4是“NT Kernel & System正在使用端口80;”

只需进入

  1. 控制面板
  2. 程序
  3. 打开Windows功能开/关
  4. 检查IIS下的万维网服务是否被选中

如果是,取消选中并再次netstat(或TCPVIEW)以查看80是否空闲。

I had this problem previously,

if you see the Task manager(after enabling the view for PID), you will find PID=4 is "port 80 in use by NT Kernel & System; "

Just go to

  1. Control Panel
  2. Programs
  3. Turn Windows features on/off
  4. check if the World wide web services under IIS is checked

If so, Uncheck and netstat(or TCPVIEW) again to see if 80 is free.

巷雨优美回忆 2024-07-25 16:26:55

netstat -a -b

应该告诉你什么程序绑定到端口 80

netstat -a -b

Should tell you what program is bound to port 80

源来凯始玺欢你 2024-07-25 16:26:55

在提升的命令提示符中使用 netstat -bano 来查看哪些应用程序正在侦听哪些端口。

但通常以下应用程序在 Windows 中使用端口 80。

  1. IIS
  2. 万维网发布服务
  3. IIS 管理服务
  4. SQL Server 报告服务
  5. Web 部署代理服务

停止以上应用程序(如果正在运行)并检查!

use netstat -bano in an elevated command prompt to see what apps are listening on which ports.

But Usually following applications uses port 80 in windows.

  1. IIS
  2. World Wide Web Publishing service
  3. IIS Admin Service
  4. SQL Server Reporting services
  5. Web Deployment Agent Service

Stop above applications if running and check!!!

上课铃就是安魂曲 2024-07-25 16:26:55

使用TcpView找到监听端口的进程并关闭该进程。

Use TcpView to find the process that listens to the port and close the process.

趁年轻赶紧闹 2024-07-25 16:26:55

可以尝试的其他选项是停止 SQL Server Reporting Services。

Other option to try is to stop SQL Server Reporting Services.

走野 2024-07-25 16:26:55

在命令行中输入“netstat -ano”。 我看到它显示了本地地址端口 0.0.0.0:80 的内容。

我的问题是因为我在端口 80 上有 SQL Server Reporting Services。因此,我按照以下说明将端口号从 80 更改为 81:

http://seankilleen.com/2012/11/how-to -stop-sql-server-reporting-services-from-using-port-80-on-your-server-field-notes/

这是我更改 SQL Server 端口号后的命令行图片Reporting Services:

在此处输入图像描述

如果您仍然遇到相同问题,请阅读此论坛:

http://forum.wampserver.com/read.php?2,66196,66233#REPLY

Type in "netstat -ano" into your command line. I saw that it was showing something for Local Address port 0.0.0.0:80.

My issue was because I had SQL Server Reporting Services on Port 80. So I followed these instructions and changed the port # from 80 to 81:

http://seankilleen.com/2012/11/how-to-stop-sql-server-reporting-services-from-using-port-80-on-your-server-field-notes/

Here is a picture of my command line AFTER I changed the port number for SQL Server Reporting Services:

enter image description here

If you are still having the same issue, read this forum:

http://forum.wampserver.com/read.php?2,66196,66233#REPLY

时常饿 2024-07-25 16:26:55

您可以使用net stop http它将显示正在使用哪个进程。 大多数万维网服务正在使用

You can use net stop http it will display which process is using. Moslty world wide web services are using

咿呀咿呀哟 2024-07-25 16:26:55

尝试

netstat -anb -p tcp

显示端口和进程

Try

netstat -anb -p tcp

that show ports and processes

请持续率性 2024-07-25 16:26:55

我试图从这里安装 nginx - http://nginx.org /en/docs/windows.html

转到 http://localhost/ 将显示一些内容,至少是一个正确的“未找到”消息
这是因为80是默认端口,它被其他进程占用了。

现在运行以下命令:

net stop http

    // Above command stopped below services  
    // - SSDP Discovery  
    // - Print Spooler  
    // - BranchCache  
    // - Function Discovery Resource Publication  
    // - Function Discovery Provider Host  

现在,访问 http://localhost/ 将失败,并显示损坏的链接页面消息。

主要流程是BranchCache
该进程停止后,将在几秒钟后重新启动。
因此,我们需要很快运行我们需要的其他命令,如下所示:

// this will stop
net stop http

// immeidately run other command you want to
start nginx

现在,转到 http://localhost/ 给了我:

Welcome to nginx!

希望有帮助。

I was trying to install nginx from here - http://nginx.org/en/docs/windows.html

Going to http://localhost/ will show something, at least a proper "not found" message
This is because 80 is the default port, and it was taken by other processes.

Now run below command:

net stop http

    // Above command stopped below services  
    // - SSDP Discovery  
    // - Print Spooler  
    // - BranchCache  
    // - Function Discovery Resource Publication  
    // - Function Discovery Provider Host  

Now, going to http://localhost/ will fail with a broken link page message.

Main process was BranchCache
This process, after stopped, will restart in a few seconds.
So we need to run other commands we need soon, an example below:

// this will stop
net stop http

// immeidately run other command you want to
start nginx

Now, going to http://localhost/ gave me:

Welcome to nginx!

Hope that helps.

治碍 2024-07-25 16:26:55

这只是一个猜测,但由于端口 80 是 HTTP 的传统端口,因此您的系统上可能运行着一个 Web 服务器。 IIS 是否处于活动状态?

如果您正在运行 IIS,则可能正在运行网络场服务。 这就是杀死我的 xampp 的原因。

This is just a guess, but since port 80 is the conventional port for HTTP, you may have a webserver running on your system. Is IIS active?

If you are running IIS you may have the web farm service running. That was what was killing my xampp.

记忆で 2024-07-25 16:26:55

Skype喜欢使用端口80并阻止IIS。 那是我的问题。

Skype likes to use port 80 and blocks IIS. That was my prob.

能怎样 2024-07-25 16:26:55

我也有同样的问题。 net stop http 没有帮助,并且 Windows 控制面板中 IIS 下的 万维网服务 选项未选中。 因此,在 XAMPP 控制面板中,我只需选中 Apache 启动按钮(将 Apache 安装为服务)附近的 Svc 复选框并重新启动 Windows。 现在,每次 Windows 启动时,Apache 都会自动启动,并先于任何其他服务占用端口 80。 为我工作!

I also had the same problem. net stop http didn't help and World wide web services option under IIS in Windows Control Panel was unchecked. So in XAMPP control panel I just checked the Svc checkbox near Apache start button (Install Apache as service) and rebooted Windows. And now each time Windows starts Apache is started automatically and occupies port 80 before any other service does. Worked for me!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文