3

I have a website(mysitedomain.com) which is running on http and https. Here is httpd.conf,

Listen 80
Listen 443
Listen 81

<VirtualHost *:80>
  ServerName mysitedomain.com
  DocumentRoot "c:/wamp/www/"
</VirtualHost>

<VirtualHost *:443>
  ServerName mysitedomain.com
  DocumentRoot "c:/wamp/www/"
  SSLEngine on
  SSLCertificateFile C:/SSL/S-WildCard.cer
  SSLCertificateKeyFile C:/SSL/S-WildCard.key
  SSLCACertificateFile C:/SSL/S_chain_cert.crt
</VirtualHost>

Now I wanna to run another website on mysitedomain.com:81, so I added,

<VirtualHost *:81>
  ServerName mysitedomain.com:81
  DocumentRoot "c:/wamp/www2/"
</VirtualHost>

But this is not working. Anything I am missing?

2 Answers2

4

After confirming port is open, try removing the port in your vhost server name, so it resembles:

    <VirtualHost *:81> 
        ServerName mysitedomain.com 
        DocumentRoot "c:/wamp/www2/" 
    </VirtualHost>

You've already defined the port number to listen on. to access the domain being served out of your www2 directory, include the port number in the url

mysitedomain.com:81

Anson W Han
  • 404
  • 2
  • 6
1

For some reason, if you cannot use separate host names or IP addresses (in my case caused by a dumb router), then the only variable left to define a VirtualHost is the port number. If there are two VirtualHosts on the same name and IP address then DefaultRuntimeDir must be set explicitly in /etc/apache2/apache2.conf:

DefaultRuntimeDir /var/run/apache2

Working this way lets me use git branches and a post-update hook to manage feature branches during development of a small web site.