By Default, Apache web server listens to port 80 for HTTP requests and port 443 for HTTPS requests. However, sometimes, you may need to change the default port number of Apache. For example, if you run Apache behind a proxy server, then port 80 will need to be given to the proxy server and Apache will have to listen to a different port. XAMPP and WAMP are two widely used software to manage Apache, MySQL and PHP on Windows platform. Let us look at how to change Apache port number in XAMPP, WAMP.
How to Change Apache Port Number in XAMPP, WAMP
Here are the steps to change Apache Port Number in XAMPP, WAMP
It is quite easy to change Apache port number in XAMPP. You just need to edit a couple of files.
1. Go to Control Panel.
2. Click on Apache – Config button.
3. Select the Option to edit httpd.conf. This allows you to directly edit the Apache config file.
4. Look for the line “Listen 80” which tells Apache which port to listen to. Change it to the new port number (e.g 801) that you want to use.
5. Scroll down to find the line “ServerName localhost:80”. Change 80 to 801 as above.
6. In case you want to also change the default HTTPS port 443 to something else, like, 4431, then click Apache – Config button and select httpd-ssl.conf from the dropdown menu.
Look for the line “Listen 443” and change 443 to 4431. Also change “<VirtualHost _default_:443>” to “<VirtualHost _default_:4431>”. Save the file.
7. Go to XAMPP Control Panel. Click Config in Control Panel. Click Service and Port Settings. Change main port to 801 and SSL port to 4431 that you have entered above. Click Save twice.
8. Restart XAMPP. Now your Apache server will listen to the new port numbers.
2. WAMP Server
It is even easier to change Apache port number in WAMP.
1. Run WAMP manager program. Click the tray icon at bottom right corner of your screen.
2. You will see a dropdown. Click Apache > Use port other than 80
3. You will see be asked to enter new port number in a box. Enter a value above 1025 (e.g 8080) and click OK.
4. Click the tray icon and click “Restart All Services” to restart all services from the menu.
Now Apache will run on new port number.