windows server 2008 r2 - 无法让 apache 在端口 80 上运行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7363470/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 08:45:43  来源:igfitidea点击:

windows server 2008 r2 - can't get apache to run on port 80

windowsapache

提问by Robbiegod

I have a rackspace cloud server running windows server 2008 r2. I've uninstalled IIS because I want to install Apache.

我有一个运行 windows server 2008 r2 的 rackspace 云服务器。我已经卸载了 IIS,因为我想安装 Apache。

I've installed Apache but it fails everytime i try to run it when i listen to port 80.

我已经安装了 Apache,但是每次我尝试在侦听端口 80 时运行它时都会失败。

I've run the command netstat -aon|finderstr "80" and i see the following:

我已经运行命令 netstat -aon|finderstr "80" 并且我看到以下内容:

C:\Users\Administrator>netstat -aon|findstr "80" TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 TCP 10.180.15.249:139 0.0.0.0:0 LISTENING 4 TCP [::]:80 [::]:0 LISTENING 4 UDP 10.180.15.249:137 :4 UDP 10.180.15.249:138 :4

C:\Users\Administrator>netstat -aon|findstr "80" TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 TCP 10.180.15.249:139 0.0.0.0:0 LISTENING 4 TCP [::]:80 [: :]:0听力4 UDP 10.180.15.249:137 4 UDP 10.180.15.249:138 4

So what are these things running on port 80 and why can't i get apache to start? Is there an alternative port for to run apache under that will work just as well as 80?

那么这些在 80 端口上运行的东西是什么,为什么我无法启动 apache?是否有一个替代端口可以在其下运行 apache 和 80 一样?

回答by ClubbedAce

To enable port 80 on Windows Server 2008 R2:

要在Windows Server 2008 R2上启用端口 80 :

NOTE: This assumes that IIS is not installed. I added this firewall rule to enable Apacheto accept connections on port 80.

注意:这假定未安装 IIS。我添加了这个防火墙规则,使Apache能够接受端口 80 上的连接。

  1. Click Start->Control Panel->Windows Firewall
  2. Click "Advanced Settings" in the left panel of Windows Firewall
  3. Click "Inbound rules" in the left panel of Advanced Settings
  4. Click "New Rule..." in right "Actions" panel
  5. Select "Port" and click "Next>"
  6. Select "TCP", then "Specific local ports:" (should already be selected)
  7. Type 80 in the box (just the number) and click "Next>"
  8. Select "Allow the connection" and click "Next>"
  9. Leave all profiles checked and click "Next>"
  10. Enter a name and click "Finish".
  1. 点击开始->控制面板->Windows防火墙
  2. 单击 Windows 防火墙左侧面板中的“高级设置”
  3. 点击高级设置左侧面板中的“入站规则”
  4. 单击右侧“操作”面板中的“新建规则...”
  5. 选择“端口”并点击“下一步>”
  6. 选择“TCP”,然后选择“特定本地端口:”(应该已经被选中)
  7. 在框中键入 80(仅数字),然后单击“下一步>”
  8. 选择“允许连接”并点击“下一步>”
  9. 选中所有配置文件,然后单击“下一步>”
  10. 输入名称并单击“完成”。

Your server should now be able to accept connections on port 80.

您的服务器现在应该能够接受端口 80 上的连接。

回答by Reggie

On a Windows server running MSSQL, disabling MSSQL ReportServer (display name: SQL Server Reporting Services (MSSQLSERVER)) services and World Wide Web Publishing services, resolved the problem for me. No need to fiddle with firewall settings or changing default port configurations.

在运行 MSSQL 的 Windows 服务器上,禁用 MSSQL ReportServer(显示名称:SQL Server Reporting Services (MSSQLSERVER))服务和万维网发布服务,为我解决了这个问题。无需摆弄防火墙设置或更改默认端口配置。

回答by ddjammin

I am running a windows 2008 r2 with IIS and sql server. I added an additional IP address to run apache and configured IIS to bind to one of the IP addresses. I ran into the same problem and found suggestions about disabling SQL reporting services and WinRM. These solutions did not work for me.

我正在运行带有 IIS 和 sql 服务器的 Windows 2008 r2。我添加了一个额外的 IP 地址来运行 apache,并将 IIS 配置为绑定到其中一个 IP 地址。我遇到了同样的问题,并找到了有关禁用 SQL 报告服务和 WinRM 的建议。这些解决方案对我不起作用。

There are many different services that can use the http server api(http.sys) and will then show up simply as pid 4.

有许多不同的服务可以使用 http 服务器 api(http.sys),然后会简单地显示为 pid 4。

I found the answer at the link below. The essence of the link is to go to a command prompt.
Type netsh press enter.
Type http and press enter. add iplisten ipaddress=x.x.x.x

我在下面的链接中找到了答案。该链接的本质是转到命令提示符。
输入 netsh 按回车键。
输入 http 并按回车键。添加 iplisten ipaddress=xxxx

http://msdn.microsoft.com/en-us/library/cc307219(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/cc307219(v=vs.85).aspx

There is also a method to disable http.sys in the registry but I do not know what the ramifications of that might be.

还有一种方法可以在注册表中禁用 http.sys,但我不知道这可能会造成什么后果。

I hope this helps someone else so they don't waste as much time as I did trying to find the resolution.

我希望这对其他人有所帮助,因此他们不会像我试图找到解决方案那样浪费太多时间。

回答by Alex

I find that I can successfully add the firewall rules to make my own server run on port 80 within the vshost visual studio debug environment but when running as a service it only works on local host from the machine and not from external hosts.

我发现我可以成功添加防火墙规则,使我自己的服务器在 vshost Visual Studio 调试环境中的端口 80 上运行,但是当作为服务运行时,它只能在机器上的本地主机上运行,​​而不能从外部主机上运行。

Very frustrating. Seems that there are possible conditions in the firewall which are not exposed in the Windows Firewall configuration interface very clearly.

非常令人沮丧。似乎防火墙中可能有一些条件在Windows防火墙配置界面中没有暴露的很清楚。

回答by Vesper

With IIS installed you need to change bindings on web sites in IIS so that none uses "all available addresses":80 binding. Either change the ports, or change listening IP addresses.

安装 IIS 后,您需要更改 IIS 中网站的绑定,以便不使用“所有可用地址”:80 绑定。更改端口或更改侦听 IP 地址。