简体   繁体   English

如何在WAMP中更改apache的端口号

[英]How to change port number for apache in WAMP

I am new to WAMP server and installed it on my system but after installing it when I check it by going to localhost url like this http://localhost/ in the browser it is not working. 我是WAMP服务器的新手,并将其安装在我的系统上,但安装后我通过在浏览器中访问localhost url这样的http://localhost/来检查它是不行的。 I am getting a 404 error and blank page . 我收到404错误和空白页面

This is because my 80 port which default in Wamp server is being used by IIS server. 这是因为IIS服务器正在使用Wamp server中默认的80端口。 So please let me know how to change port number in Wamp server and solved this problem. 所以,请让我知道如何更改Wamp服务器中的端口号并解决了这个问题。

Click on the WAMP server icon and from the menu under Config Files select httpd.conf . 单击WAMP服务器图标,然后从Config Files下的菜单中选择httpd.conf A long text file will open up in notepad. 一个长文本文件将在记事本中打开。 In this file scroll down to the line that reads Port 80 and change this to read Port 8080 , Save the file and close notepad. 在此文件中向下滚动到读取Port 80的行,并将其更改为读取Port 8080 ,保存文件并关闭记事本。 Once again click on the wamp server icon and select restart all services. 再次单击wamp服务器图标,然后选择重新启动所有服务。 One more change needs to be made before we are done. 在我们完成之前还需要做一个改变。 In Windows Explorer find the location where WAMP server was installed which is by Default C:\\Wamp . 在Windows资源管理器中,找到安装WAMP服务器的位置,默认为C:\\Wamp


Update : On a newer version of WAMP, click the WAMP server icon > Apache > httpd.conf , then change the line Listen 80 to Listen 8080 or any port you want. 更新:在较新版本的WAMP上,单击WAMP服务器图标 > Apache > httpd.conf ,然后将Listen 80行更改为Listen 8080或您想要的任何端口。

Update: On 3.1.6 version of WAMP , right click on the wamp server icon in the taskbar ,select "tools"-> "Port used by Apache:80" -> "use a port other than 80", an input box will pop up , input a new port in it,click confirm button , then restart wamp . 更新:在3.1.6版本的WAMP上,右键单击任务栏中的wamp服务器图标 ,选择“工具” - >“Apache使用的端口:80” - >“使用80以外的端口”,输入框将弹出,在其中输入一个新端口,单击确认按钮,然后重新启动wamp。

Just go to httpd.conf file, for ex. 只需转到httpd.conf文件,例如。 under WAMP environment its situated at: 在WAMP环境下,它位于:

C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf

go to line no. 去行号。 46 and edit Listen 80 to your requirement for ex. 46并编辑Listen 80以满足你的要求。

Listen 8383

newer versions of WAMP uses these 2 lines: 较新版本的WAMP使用以下两行:

Listen 0.0.0.0:8383  
Listen [::0]:8383

Next go to line no. 接下来去行号。 171 and edit ServerName localhost:80 to your requirement for ex. 171并根据您的要求编辑ServerName localhost:80

ServerName localhost:8383

Restart Apache and its done !! Restart Apache并完成!!

Now, you can access with your URL: 现在,您可以使用您的网址进行访问:

http://localhost:8383 or http://192.168.1.1:8383

Hope it helps to people looking for solution here. 希望这对寻求解决方案的人有所帮助。

From the wampserver 3.x onwards, changing the listening port number of Apache does not require any particular Apache skills (http.conf, virtualhost,...), you just have to click button - assuming you're running Windows OS! wampserver 3.x开始, 更改Apache的监听端口号不需要任何特定的Apache技能(http.conf,virtualhost,...),你只需要点击按钮 - 假设你正在运行Windows操作系统! :

  1. In the tray, right click green/running WAMP icon 在托盘中,右键单击绿色/正在运行的WAMP图标
  2. Select menu Tools 选择菜单工具
  3. In the section Port used by Apache: xx , click Use a port other than 80 (ie default port configuration) Apache 使用的端口部分:xx中 ,单击使用80以外的端口 (即默认端口配置)
  4. Enter the desired port number in the popup window - usually 8080 as alternative Web port 在弹出窗口中输入所需的端口号 - 通常为8080作为备用Web端口

NB: For alternative port: check official IANA Service Name and Transport Protocol Port Number Registry 注意:对于替代端口:检查官方IANA服务名称和传输协议端口号注册表

Change port number for Xampp Go to the file C:\\xampp\\apache\\conf\\httpd.conf 更改Xampp的端口号转到文件C:\\ xampp \\ apache \\ conf \\ httpd.conf

#Listen 12.34.56.78:80
Listen 80

Change 80 to 82 将80更改为82

as

#Listen 12.34.56.78:82
Listen 82

now your url will be 现在你的网址将是

http://localhost:82

In lieu of changing the port, I reclaimed port 80 as being used by IIS. 代替更改端口,我将端口80重新用作IIS使用。

So I went to services, and stopped the following: 所以我去了服务,并停止了以下内容:

  1. World Wide Web Publishing Services. 万维网发布服务。
  2. Web Management Service 网络管理服务
  3. Web Deployment Agent Service. Web部署代理服务。

set them to manual so that it will not start on dev environment restart. 将它们设置为手动,以便它不会在dev环境重启时启动。

You could try changing Apache server to listen to some other port other than port 80. 您可以尝试更改Apache服务器以侦听端口80以外的其他端口。

Click on yellow WAMP icon in your taskbar Choose Apache -> httpd.conf Inside find these two lines of code: 单击任务栏中的黄色WAMP图标选择Apache - > httpd.conf Inside找到以下两行代码:

Listen 80 ServerName localhost:80 and change them to something like this (they are not one next to the other): 监听80 ServerName localhost:80并将它们更改为类似的东西(它们不是另一个旁边的):

Listen 8080 ServerName localhost:8080 侦听8080 ServerName localhost:8080

In addition of the modification of the file C:\\wamp64\\bin\\apache\\apache2.4.27\\conf\\httpd.conf . 另外修改了文件C:\\wamp64\\bin\\apache\\apache2.4.27\\conf\\httpd.conf
To get the url shortcuts working, edit the file C:\\wamp64\\wampmanager.conf and change the port: 要使URL快捷方式正常工作,请编辑文件C:\\wamp64\\wampmanager.conf并更改端口:

[apache]
apachePortUsed = "8080"

Then exit and relaunch wamp. 然后退出并重新启动wamp。

Click on the WAMP server icon and from the menu under Config Files select httpd.conf. 单击WAMP服务器图标,然后从Config Files下的菜单中选择httpd.conf。 A long text file will open up in notepad. 一个长文本文件将在记事本中打开。 In this file scroll down to the line that reads Port 80 and change this to read Port 8080, Save the file and close notepad. 在此文件中向下滚动到读取端口80的行,并将其更改为读取端口8080,保存文件并关闭记事本。 Once again click on the wamp server icon and select restart all services. 再次单击wamp服务器图标,然后选择重新启动所有服务。 One more change needs to be made before we are done. 在我们完成之前还需要做一个改变。 In Windows Explorer find the location where WAMP server was installed which is by Default C:\\Wamp. 在Windows资源管理器中,找到安装WAMP服务器的位置,默认为C:\\ Wamp。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM