How to get WAMP and a domain name to work on a non-standard port

apache-2.2

I have read countless articles on setting up a domain on WAMP to listen on a port other than 80; none of them are working.

I've got Windows Server 2008 (Standard) with IIS 7 installed and running on port 80 (and 443).

I've got WAMP installed with the following configuration.

Listen 81
ServerName sub.example.com:81
DocumentRoot "C:/Path/To/www"
<Directory "C:/Path/To/www">

    Options All MultiViews

    AllowOverride All

#   onlineoffline tag - don't remove
    Order Allow,Deny
    Allow from all

</Directory>

localhost:81 works with the above configuration but sub.example.com:81 does not.

Just to make sure my firewall wasn't getting in the way I have disabled it completely.

My sub.example.com domain is already pointing to my server and works on IIS on port 80.

Also, if I disable IIS and change the Apache port from 81 to 80 it works.

Yes, I am restarting Apache after each httpd.conf change. 🙂

I don't need any other domain (or sub domains [I don't even care about localhost]) configured which is why I'm not using a VirtualHost.

Any ideas what is going on here? What could I be doing wrong?


Update

Changing Listen to 80 but keeping ServerName as sub.example.com:81 causes navigation to sub.example.com:80 to work; this just doesn't seem right to me. Could ServerName be ignoring the :port part somehow?


netstat -a -n | find "TCP":

>netstat -a -n | find "TCP"
  TCP    0.0.0.0:81             0.0.0.0:0              LISTENING
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:912            0.0.0.0:0              LISTENING
  ...
  TCP    127.0.0.1:81           127.0.0.1:49709        TIME_WAIT
  ...

Best Answer

#facepalm

The router was configured to allow ports 80 and 443 only. That is why port 81 worked with localhost but not the domain.

I just needed to forward ports 80 AND 81 to the web-server and it worked.

Related Topic