How to make WAMPSERVER open localhost at another port number instead of default 80?

wampserver php mysql apache on windows

How to make WAMPSERVER open localhost at another port number instead of default 80? (Eg: http://localhost:8080)

There are situations when you might need to change the default port number used by Apache (port number 80) to something else. Such situations are like when you have Internet Information Services (IIS) running on the same machine etc. If IIS is required, keep it as it is and change the default port for Apache to listen to.



How to change Apache Server localhost port number from 80 to 8080?

Steps to change the Apache’s port number:

  • Go to the path where Apache is installed.
  • From a local development computer running WAMPSERVER the location is C:\wamp\bin\apache\apache2.4.9\conf”
  • Open the “httpd.conf” file in a file editor such as Notepad or Notepad ++
  • It might be more readable to open the httpd.conf file in Notepad++ instead of Notepad.
  • Find the following and change from 80 to 8080
Find:
Listen 0.0.0.0:80
Listen [::0]:80


Change to:
Listen 0.0.0.0:8080
Listen [::0]:8080

  • After making the change, save the file
  • Restart Apache Services
After the change, if you want WAMPSERVER to open “localhost/phpmyadmin” using the new port, then following the steps mentioned further below.

Steps to let WAMPSERVER open localhost using the port 8080 after changing port number

•    Navigate to the location where you have WAMP installed. Usually “C:\wamp”
•    Find the file named: “wampmanager.tpl’. This is the WAMPSERVER template file.
•    Open “wampmanager.tpl” in a text editor. I prefer Notepad++
•    Locate any string with “http://localhost….” mentioned
•    Change any string mentioned “http://localhost….” to “http://localhost:8080….”

Example:
•    At line number 131 to 135 of wampmanager.tpl we see the following lines for “localhost”
[Menu.Left]
;WAMPMENULEFTSTART
Type: separator; Caption: "Powered by Alter Way"
Type: item; Caption: "${w_localhost}"; Action: run; FileName: "${c_navigator}"; Parameters: "http://localhost/"; Glyph: 5

;WAMPPROJECTSUBMENU

•    Append “:8080” to localhost. So it must look like:

[Menu.Left]
;WAMPMENULEFTSTART
Type: separator; Caption: "Powered by Alter Way"
Type: item; Caption: "${w_localhost}"; Action: run; FileName: "${c_navigator}"; Parameters: "http://localhost:8080/"; Glyph: 5
;WAMPPROJECTSUBMENU

•    Do the same for phpmyadmin and others if you like to.
•    Save the file.
•    Exit WAMPSERVER
•    Restart WAMPSERVER
•    Test Localhost
It should now open “http://localhost:8080” instead of “http://localhost” when Apache is clicked.

No comments