Change Apache Server Port 80 in XAMPP, WAMP Server, UwAmp, UniServer and MAMP
If you are a webmaster it’s quite likely you will need to periodically make changes to your website. It could be a small change such as a editing the CSS, Javascript or PHP code on your site. Or you might want to do something more substantial like completely redesign the website. While it’s possible to perform such tasks on the fly and apply them directly to your website or upload the files via FTP, you could introduce bugs, glitches or even security holes to your visitors.
A sensible solution is cloning your website and making changes to the backup first to see if they work. The easiest way is to create a local website on your own computer. You cannot just copy the website files to your computer and expect them to work, as a local web server such as Apache and a MySQL database will be required. There are many server packages around that can do this such as XAMPP, WAMP Server, Uniform Server, UwAmp and more.
When setting up your local web server, one issue that might stop it from running is something else could be using the system port that Apache requires to function. By default Apache relies on port 80 to be free, and if it isn’t, the server won’t start and the local website won’t load. As several programs cannot share the same port, you need to find what is already using port 80, then decide what to do.
Here we show you how to find out what might be using port 80 on your computer and what to do if you have to change the port from 80 to something else in your Apache server software.Determine What is Blocking Port 80
If your local Apache server is not loading and you believe another application has a hold on port 80, it’s a good idea to find out what the cause is. Luckily, some server software like XAMPP, WAMP Server and others usually tell you what is causing the issue so you don’t have to go through too much detective work.
Not every piece of software tells you though so more work might be needed. There’s several ways to check the ports and what is using them, we’ll look at the command line and a port viewer tool.
From Command Prompt
Open an administrator Command Prompt and type the following command:
netstat -abno
Scroll to the top and look for a local address with a port of “:80”. If there is an entry look underneath on the next line and it will hopefully tell you the executable that is on the port.
In this case the process is Skype.exe, from that information we can try to make Skype use another port and let our Apache server use port 80 instead. Sometimes though, you will not be told what the process name is.
If you receive “Can not obtain ownership information”, it becomes more difficult to trace the offender. A common entry with a PID value of 4 means the port is being used by the Windows System process which always has a PID of 4.
Using a Port Viewer Tool
There are many different network monitoring tools that can show you what ports are being used by the system from a user interface, even your antivirus software might have the ability. A couple of small, portable and easy to use tools are Sysinternals TCPVIew and Nirsoft CurrPorts.
We’ll use CurrPorts, simply run the tool and click the Local Port column header to sort the connections by port number. From there you can see if port 80 is in use and what is using it. Unlike Command Prompt you can see this time it actually tells you if the cause is the System process.
Freeing Up Port 80 For Apache Server
Once you have the process name of the program that is occupying port 80, find the software on the computer and see if it’s ports can be changed. One of the most common causes of this issue is Skype because it defaults to using ports 80 and 443. Thankfully that can be changed quite easily.
In Skype go to Tools > Options (Ctrl+,) and click on Advanced > Connection. Uncheck “Use port 80 and 443 for additional incoming connections”. click Save and restart Skype.
Now restart your server and port 80 should no longer be used by Skype and free for Apache to use.
If the System process is using port 80 it becomes more difficult to directly tell what the cause is. Common culprits include web server software like Microsoft’s Internet Information Services (IIS) or Microsoft Web Deploy. Other similar applications on your system may be the problem so you will have to check what’s installed.
To see if you have IIS or Web Deploy installed, click Start and type services.msc. Look for services called Web Deployment Agent Service and World Wide Web Publishing Service. If you find either and its status is started, click on the entry and press Stop the service.
Try to start Apache and port 80 should be free while IIS and Web Deploy are stopped. You can start the service again after launching the Apache server. Web Deploy should be listed in Programs and Features for uninstall but if it isn’t you can always disable the service or set it to manual while using your Apache server. IIS is found in Programs and Features > Windows Features, to remove it just uncheck all Internet Information Services options and restart the computer.
Change The Port in Your Apache Server Software
If you cannot determine what is using port 80 or the software does not allow you to change ports to something else, you are left with a couple of options. Either remove the software and free up the port or change the port in Apache server from 80 to something else which doesn’t conflict with other software. Here we show you how to do that in a selection of Apache based web servers.
XAMPP
Changing port 80 in the popular XAMPP to something different is relatively easy and you only have to edit a couple of files, which are accessible from the XAMPP Control Panel.
1. In the Control Panel click on the Apache – Config button and select to edit httpd.conf.
2. Look for the line “Listen 80” which is the line to tell Apache what port to use. Change that value to another number, such as 801 or 8000.
3. Search lower down the same file and find “ServerName localhost:80”, also change the 80 to the same value as above. Then save the httpd.conf file.
4. If XAMPP also complains about port 443 being in use, click the Apache – Config button and select httpd-ssl.conf. Search for and change the line “Listen 443” to something else, such as 4431. Also change “<VirtualHost _default_:443>” to “<VirtualHost _default_:4431>”, and save the file.
5. XAMPP will still complain about the ports until you do one final thing. Click Config in the Control Panel, then the Service and Port Settings button. Change the Main Port to the port 80 alternative from step 2 and the SSL Port to the alternative from step 4. Press Save twice.
Restart XAMPP and start the Apache server, it should now run without issues on the new ports you provided.
WAMP Server
XAMPP and WAMP Server are probably the most popular Apache server applications available. WAMP Server can be more tricky to troubleshoot because it has no user interface although changing port 80 is easier now than in older versions.
1. Run the WAMP Manager program and the tray icon will be orange if Apache hasn’t started due to the conflict. If you don’t know yet what else is using port 80, click the icon > Apache > Test Port 80.
2. To change the port number click the icon > Apache > Use a port other than 80 and enter a new value into the box. Don’t enter a port value below 1025 or a not valid error will popup.
3. Restart all services from the menu and you should now get a green tray icon meaning Apache has connected.
UwAmp
UwAmp is quite a user friendly WAMP based server and it’s easily possible to change port 80 and optionally port 443 from the user interface.
1. Launch UwAmp and it will popup a warning if one of the required ports is not available. Click the Apache Config button in the main interface.
2. In the virtual server list the default ports of 80 and 443 are listed. Simply select the first one and enter an alternative value in the box to the right. Do the same for the second and supply an alternative to port 443. Click OK when done.
Press Start to launch Apache server and you should get a green status indicator.
MAMP
MAMP is another relatively easy to use piece of local server software, and like UwAmp, it has a user friendly frontend interface to handle port changes.
1. When you launch MAMP it will complain about Apache needing port 80 if it’s in use by something else. Click Preferences and go to the Ports tab.
2. In the Apache Port box change the value from 80 to something else, such as 801, 8080 or 8000. Then click OK.
After pressing OK MAMP will automatically try to start the Apache and MySQL servers, the little boxes in the top right will indicate success.
Uniform Server
Uniform Server is currently my server software of choice because it’s small, portable and very lightweight. It also warns and gives some information about what is blocking port 80 with a popup on start.
1. Start UniServer Zero which is the frontend tool for launching your server. Then click the Apache menu > Change Apache Ports > Change Apache Port.
2. Enter an alternative value to the default of 80, and click OK twice.
3. If you need the SSL port to be free as well, use the Change Apache SSL Port option and change it to something other than 443.
Click the Start Apache button and you should get a green light for a successful connection.
AMPPS
We did look at AMPPS but it has a few problems when you change the port manually to something other that 80. For instance, a port change has no effect on and breaks the Localhost button, AMPPS Home, AMPPS Admin, phpMyAdmin, and apps in the enduser Panel. It will also cause installed scripts not to work. For these reasons, if you must use a port other than 80, it is recommended to use something else for your web server software that is more flexible.
Final Note: If you had to change the Apache port in your local server software, remember that the URL to your local website will now need the port number supplied. For example, if the old address was localhost/mysite or 127.0.0.1/blog, it will now need the new port number, e.g. localhost:801/mysite or 127.0.0.1:801/blog. Failure to do that will result in the site not loading.
very useful artical specially second option is best and working for me
Thanks for that article, it really helped me:
I had the same problem 5 years ago and for what I remember, I had to desintall skype, make wamp work and reinstall skype just after. The problem is that I installed a new version of Visual studio which was VS2010 and that was a problem of microsoft web deployment.
Today, I had the same problem after recently installing VS2015 and I almost knew it was somehow the fault of Microsoft but did not know which was the guilty process.
So… big congrats here because it is by far the best article I’ve read about that problem. You made my day. I owe you one!
Thank you.
used services.msc
stopped only world wide web publishing service
thank you for your support
On port 80 apache works, once I changed it it stopped working.
Thanks for your help it really worked.