How to change XAMPP apache server port?
This is my Apache httpd.conf settings :
Listen 8012
ServerName localhost:8012
Every time I start Apache via XAMPP
I see this message:
Status Check OK
Busy…
Apache Started [Port 80]
Anybody, please help me can I change any other settings ?
Solution 1:
To answer the original question:
To change the XAMPP Apache server port here the procedure :
1. Choose a free port number
The default port used by Apache is 80
.
Take a look to all your used ports with Netstat (integrated to XAMPP Control Panel).
Then you can see all used ports and here we see that the 80
port is already used by System
.
Choose a free port number (8012
, for this exemple).
2. Edit the file "httpd.conf
"
This file should be found in
C:\xampp\apache\conf
on Windows or inbin/apache
for Linux.:
Listen 80
ServerName localhost:80
Replace them by:
Listen 8012
ServerName localhost:8012
Save the file.
Access to : http://localhost:8012 for check if it's work.
If not, you must to edit the http-ssl.conf
file as explain in step 3 below. ↓
3. Edit the file "http-ssl.conf
"
This file should be found in
C:\xampp\apache\conf\extra
on Windows or see this link for Linux.
Locate the following lines:
Listen 443
<VirtualHost _default_:443>
ServerName localhost:443
Replace them by with a other port number (8013
for this example) :
Listen 8013
<VirtualHost _default_:8013>
ServerName localhost:8013
Save the file.
Restart the Apache Server.
Access to : http://localhost:8012 for check if it's work.
4. Configure XAMPP Apache server settings
If your want to access localhost without specify the port number in the URL
http://localhost instead of http://localhost:8012.
- Open Xampp Control Panel
- Go to Config ► Service and Port Settings ► Apache
- Replace the Main Port and SSL Port values with those chosen (e.g.
8012
and8013
). - Save Service settings
- Save Configuration of Control Panel
- Restart the Apache Server It should work now.
4.1. Web browser configuration
If this configuration isn't hiding port number in URL it's because your web browser is not configured for. See : Tools ► Options ► General ► Connection Settings... will allow you to choose different ports or change proxy settings.
4.2. For the rare cases of ultimate bad luck
If step 4 and Web browser configuration are not working for you the only way to do this is to change back to 80, or to install a listener on port 80 (like a proxy) that redirects all your traffic to port 8012.
To answer your problem :
If you still have this message in Control Panel Console :
Apache Started [Port 80]
- Find location of
xampp-control.exe
file (probably inC:\xampp
) - Create a file
XAMPP.INI
in that directory (soXAMPP.ini
andxampp-control.exe
are in the same directory)
Put following lines in the XAMPP.INI
file:
[PORTS]
apache = 8012
Now , you will always get:
Apache started [Port 8012]
Please note that, this is for display purpose only.
It has no relation with your httpd.conf
.
Solution 2:
The best solution is to reconfigure the XAMPP Apache server to listen and use different port numbers. Here is how you do it:
1) First, you need to open the Apache “httpd.conf” file and configure it to use/listen on a new port no. To open httpd.conf file, click the “Config” button next to Apache “Start” and “Admin” buttons. In the popup menu that opens, click and open httpd.conf
2) Within the httpd.conf file search for “listen”. You’ll find two rows with something like:
#Listen 12.34.56.78:80
Listen 80
Change the port no to a port no. of your choice (e.g. port 1234) like below
#Listen 12.34.56.78:1234
Listen 1234
3) Next, in the same httpd.conf file look for “ServerName localhost:” Set it to the new port no.
ServerName localhost:1234
4) Save and close the httpd.conf file.
5) Now click the Apache config button again and open the “httpd-ssl.conf” file.
6) In the httpd-ssl.conf file, look for “Listen” again. You may find:
Listen 443
Change it to listen on a new port no of your choice. Say like:
Listen 1443
7) In the same httpd-ssl.conf file find another line that says <VirtualHost _default_:443>
. Change this to your new port no. (like 1443)
8) Also in the same httpd-ssl.conf you can find another line defining the port no. For that look for “ServerName”. you might find something like:
ServerName www.example.com:443 or ServerName localhost:433
Change this ServerName to your new port no.
8) Save and close the httpd-ssl.conf file.
9) Finally, there’s just one more place you should change the port no. For that, click and open the “Config” button of your XAMPP Control Panel. Then click the, “Service and Port Settings” button. Within it, click the “Apache” tab and enter and save the new port nos in the “main port” and “SSL port” boxes. Click save and close the config boxes.
That should do the trick. Now “Start” Apache and if everything goes well, your Apache server should start up.
You will also see the Apache Port/s no in the XAMPP control panel has change to the new port IDs you set.
Solution 3:
If the XAMPP server
is running for the moment, stop XAMPP server.
Follow these steps to change the port number.
Open the file in following location.
[XAMPP Installation Folder]/apache/conf/httpd.conf
Open the httpd.conf
file and search for the String:
Listen 80
This is the port number used by XAMMP.
Then search for the string ServerName and update the Port Number which you entered earlier for Listen
Now save and re-start XAMPP server.
Solution 4:
Have you tried to access your page by typing "http://localhost:8012" (after restarting the apache)?
Solution 5:
I had problem too. I switced Port but couldn't start on 8012.
Skype was involved becouse it had the same port - 80. And it couldn't let apache change it's port.
So just restart computer and Before turning on any other programs Open xampp first change port let's say from 80 to 8000 or 8012 on these lines in httpd.conf
Listen 80
ServerName localhost:80
Restart xampp, Start apache, check localhost.