如何为 Apache 打开以前被 Visual Studio 服务器占用的 80 端口?
我在 WAMP 之后安装了 Visual Studio 2010,并且必须打开 IIS。现在我想使用 WAMP,但即使我禁用了 IIS,甚至卸载了 Visual Studio 2010,我的 Apache 也无法打开。
I installed Visual Studio 2010 after WAMP and had to turn on IIS. Now I want to use my WAMP but my Apache is not turning on even after I have disabled IIS and even uninstalled my Visual Studio 2010.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以在Apache服务器的
httpd.conf
配置文件中设置端口号。通常位于 Apache 安装文件夹的“conf”文件夹内。 (例如,
c:\wamp\Apache2\conf\httpd.conf
)然后将行
Listen 80
更改为Listen 8081
。重新启动您的 Apache 服务器。提示:您可以同时安装 IIS 和 Apache,并且可以同时使用两者。您所需要的只是为 Apache 和 IIS 设置不同的端口号。
默认情况下,它们都使用端口 80,但您可以按照上面的说明进行更改。
我忘了提及,当您使用 80 以外的端口号时,您必须将浏览器地址栏更改为
http://localhost:8081/
或http://127.0.0.1:8081/
You can set the port number in
httpd.conf
configuration file of Apache server.Usually inside the "conf" folder of Apache installation folder. (Say,
c:\wamp\Apache2\conf\httpd.conf
)Then change the line
Listen 80
toListen 8081
. Restart your Apache server.Tip: You can install IIS and Apache together, and you can work on both at the same time. All what you need is, set different port numbers for Apache and IIS.
By default, both of them use Port 80, but you can change it as said above.
I forgot to mention, when you're using a port number other than 80, you MUST change the browser addressbar as
http://localhost:8081/
orhttp://127.0.0.1:8081/
我从一位用户发布的 superuser.com 上发现了这一点,所以希望它也能有所帮助。 :)
要在 Windows 防火墙中添加端口 80 的规则,请执行以下操作:
转至控制面板并启动“Windows 防火墙”
前往“高级设置”
在左侧窗格中选择“入站规则”
在右侧窗格中选择“新建规则”
在新建入站规则向导中,选择“端口”作为规则类型,然后单击“下一步”
选择“TCP”并在“特定本地端口”中输入“80”(以及您要打开的任何其他端口),然后单击“下一步”
选择“允许连接”,然后单击“下一步”
选择应应用规则的网络位置(如果不确定,请选择全部),然后单击“下一步”
提供名称和可选描述
应该可以做到这一点。
I found this from superuser.com which one of users posted up , so hope it helps as well. :)
To add a rule in the Windows Firewall for port 80, do the following:
Go to the Control Panel and launch "Windows Firewall"
Go to "Advanced Settings"
Select "Inbound Rules" in the left pane
Select "New Rule" in the right pane
In the New Inbound Rule Wizard, select "Port" as Rule Type, then click on "Next"
Select "TCP and put "80" (and any other ports you want to open) in "Specific local ports", then click on "Next"
Select "Allow the connection", then click on "Next"
Select the network location where the rule should apply (select them all if you're not sure), then click on "Next"
Give a name and an optional description
That should do it.
如果您安装了 Visual Studio,则可能还安装了SQL Server。我发现如果安装并启动了SQL Server Reporting Services,它也会使用端口 80,这导致了我的问题。
以下是我解决该问题的方法:
services.msc
。Sql Server Reporting Services
。状态
显示为已开始
,请右键单击该行,然后单击停止
。属性
。启动类型
更改为手动
。现在,您已停止 SQL Server Reporting Services,并阻止该服务在下次计算机重新启动时再次启动。请注意,如果您需要该服务正常工作,则需要手动启动它。
现在,SQL Server Reporting Services 不会对 WAMP 造成任何问题。您应该重新安装 Apache 服务。步骤如下:
停止所有服务
。Apache >服务>安装服务
。重新启动所有服务
。WAMP 图标应变为绿色,一切都会正常工作。
If you installed Visual Studio, you may also have installed SQL Server. I found out that if SQL Server Reporting Services was installed and started, it uses port 80 too which was causing my problem.
Here is what I did to solve the issue:
services.msc
.Sql Server Reporting Services
in the list.Status
readsStarted
, right-click on the line and click onStop
.Properties
.Startup type
toManual
.You now have stopped SQL Server Reporting Services and prevent the service from starting again on your next computer restart. Note that if you need that service to work, you will need to start it manually.
Now, SQL Server Reporting Services won't cause any problem with WAMP. You should reinstall the Apache service. Here are the steps:
Stop All Services
.Apache > Service > Install Service
.Restart All Services
.The WAMP icon should turn to green and everything will work fine.
添加或删除程序、添加或删除 Windows 组件、取消选中 IIS
Add or Remove programs, Add or remove windows components, uncheck IIS
在cmd中查看哪个程序占用了端口
NETSTAT -p tcp -ano
查找程序的PID
在任务管理器中->流程->查看->选择列并启用 PID。找出占用端口的进程(如果没有找到,请检查服务选项卡)
结束该进程并尝试启动 WAMP。对于长期运行,请卸载该程序或将其配置为使用另一个端口
in cmd, see which program is occupying the port
NETSTAT -p tcp -ano
find the PID of the program
in task manager -> process -> view -> select column and enable PID. Find out the process that is occupying the port (if not found check the service tab as well)
end the process and try to start WAMP. For long run, uninstall that program or configure it to use another port