I have installed xampp control panel and Apache 2.2 on windows XP when I type http://localhost/ gives me page which says It Works!

Now, I want to change the port number 80 to some other number

How to change it ? in how many files does it needs to be changed ? dose it require to restart the system to change to take effect ?

Note: I have changed port number in C:\xampp\apache\conf\httpd.conf

in two places where it says

Listen 80


ServerName localhost:80

Pls help, thanks.

migrated from stackoverflow.com Mar 9 '10 at 6:39

This question came from our site for professional and enthusiast programmers.

  • Edit your "httpd.conf" file and replace the number 80 to whatever you like, e.g, 90 in "Listen 80" so this would change to "Listen 90". – Sohail xIN3N Jun 23 '14 at 11:21

Please go to the


and change

Listen 80


Listen 8080

or any port.

Remember to allow that port through firewall and you have restart the Apache service not the system.


Go to your httpd.conf file and on about like 40ish change:

Listen 80


Listen 1234

Or whatever port you choose!


1 Open Httpd.conf file from (c:/xamp/apache/conf) and edit Replace the words

Listen 80 to Listen 8080

2 ServerName localhost:80 To ServerName localhost:8080 And save the file.

  1. Open the file httpd-ssl.conf from (c:/ xamp/apache/conf/extra). for edit ssl port number to 8081 So need to replace

Listen 443 To Listen 8081

**<VirtualHost _default_:443> To <VirtualHost _default_:8081>**

ServerName localhost:8013 To ServerName localhost:8081

Save File

  1. Open Xamp

  2. Go to Config -> Service and Port Settings -> Appache

  3. Change Main port to 8080 and SSL Port to 8081

More in Details


Go to your apache-tomcat Installation folder there you find conf folder inside that server.xml file will be there.. You can change the port number and configuration setting for your server.



thanks for response

but only changing port number in: C:\xampp\apache\conf\httpd.conf didn't work (apache couldn't start)

so with above mention change,

we have to change port number in another file to make it work

i have changed in : C:\xampp\apache\conf\extra\httpd-ssl.conf

in above file

(if port number you want is 85)

Listen 443

change it to

Listen 85

find change it to


ServerName localhost:443

change it to

ServerName localhost:85

the port number in C:\xampp\apache\conf\httpd.conf and C:\xampp\apache\conf\extra\httpd-ssl.conf should be different.

restart Apache service in XAMPP Control Panel and type in your browses address bar : http://localhost:'port number'/


It is quite easy .You need to make few changes to httpd.conf file as follows: Listen 80 to Listen 8080 and ServerName localhost:80 to ServerName localhost:8080

For more detailed info with screenshots ,you can refer this - http://www.superpctricks.com/2013/11/running-iis-and-apache-on-same-server.html

  • Please summarize the article that you linked, quoting any relevant code segments or configuration blocks. Sites can change in the future or fail to load for any number of reasons. – 89c3b1b8-b1ae-11e6-b842-48d705 Nov 27 '13 at 14:08

Old question, but maybe this helps someone..

If you are running in a virtual host environment, just change the top line of the virtual host directive:

    ServerName www.example.com
    DocumentRoot "/www/domain-18080"

You will still need to add the listen 18080 directive in httpd.conf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy