A few months back I ran into the need to configure my private Website running on Apache to use multiple ports. The Internet provider for my home began to block inbound Port 80, so I had to configure Apache to use an alternate port. The process was very easy, and since I was recently asked “how” on my blog, I figured I’d document the process real quick for all the readers.
Context: In my example, I ran Apache on Port 80 on a single IP. However, I needed Apache to Listen on and serve my website on port 8080 as well. Although I chose Port 8080, you can use any Port (however I recommend a port over 1000). Ok, let’s get into it.
Step 1: Open Apache configuration File httpd.conf (on my windows host, it’s located here: “c:\Program Files\Apache Group\Apache2\conf”)
Step 2: Find the line: Listen 80 and Type Listen 8080 on the next line:
Note, your config might look different, but you should get the point
Step 3: Find the VirtualHost portion for your Website config and Add *:8080 as shown below:
Note, your config file might not look exactly like mine. Instead of *:80 you might see an IP address:80 – it depends, but this should give you the general idea. You can also just replace the old port number with the new one if you don’t need your site accessible on both Ports.
Step 4: Restart Apache Web Service
All Done. Your Website should now be accessible using either Port.
Be sure to test your work by hitting your website on the new Port number: http://www.yoursite.com:8080.