Running Websites on Non-Standard Ports

Posted: 2013-10-31 22:04:16

These instructions will enable you to access your website externally via a port other than 80 (which might be blocked by your ISP).

Note that when using non-standard ports such as 8081 to host your website, to access your website you’ll need to specify the port number in the URL –

Edit VirtualHost

Select your website in WampDeveloper’s Websites Tab, click the HTTP VirtualHost button.

Replace this…

<VirtualHost *:80>

With this…

Listen 8081
NameVirtualHost *:8081
<VirtualHost *:8081>

Remove Redirect Rules

Then comment out (#) or remove the “Domain Alias to Primary Domain” redirect lines (if they are present), which are similar to these lines…

# Redirect all ServerAlias(es) to main domain
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^/*(.*)$$1 [R=301,NC]

Save the VirtualHost file. Restart Apache.

Open and Route New Port

Sine you are probably doing this to open access to your server from outside, you’ll need to:

1. Open the new port in your Windows Firewall for incoming TCP requests.

2. And make sure your Router has the proper port-forward rules in place to forward WAN:port to LAN:port traffic, or the requests will never reach the proper LAN server.


1. If Apache won’t start, run from the command line (click Command Line button in System Tab):
httpd -n "Apache2" -t

Or if Apache service name is the default “Apache2.4″ or “Apache2.2″, then just:
httpd -t

2. From now on, you should not enable the ‘Forward To Primary Domain – All Aliases’ option for this website (in website’s Settings), as the above redirect lines might not work correctly for port specified URLs (*edit: now fixed in WampDeveloper v4.2.0.0 and above).

3. Also note that some parts of WampDeveloper might not been fully configured for running on non-standard ports; this could cause a few minor issues.

*Edit: WampDeveloper v4.2.0.0 and above now contains new Domain Aliases to Primary Domain Redirect rules that preserve port numbers, and it should not be necessary to comment-out or remove those rules/lines.