Running Websites on Non-Standard Ports

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 -

http://www.example.com:8081/

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 ^/*(.*)$ http://www.example.com/$1 [R=301,NC]

Save the VirtualHost file. Restart Apache.

Notes

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

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 WampDeveloper has not been fully vetted for running websites 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.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>