Declaring multiple ports for the same VirtualHosts

Posted by user65567 on Server Fault See other posts from Server Fault or by user65567
Published on 2011-01-06T04:24:30Z Indexed on 2011/01/06 4:55 UTC
Read the original article Hit count: 304

Declare multiple ports for the same VirtualHosts:

SSLStrictSNIVHostCheck off


# Apache setup which will listen for and accept SSL connections on port 443.
Listen 443
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:443


<VirtualHost *:443>
  ServerName domain.localhost
  DocumentRoot "/Users/<my_user_name>/Sites/domain/public"

  <Directory "/Users/<my_user_name>/Sites/domain/public">
    Order allow,deny
    Allow from all
  </Directory>

  # SSL Configuration
  SSLEngine on
  ...
</VirtualHost>

How can I declare a new port ('listen', ServerName, ...) for 'domain.localhost'?

If I add the following code, apache works (too much) also for all other subdomain of 'domain.localhost' (subdomain1.domain.localhost, subdomain2.domain.localhost, ...):

<VirtualHost *:80>
  ServerName pjtmain.localhost:80
  DocumentRoot "/Users/Toto85/Sites/pjtmain/public"

  RackEnv development

  <Directory "/Users/Toto85/Sites/pjtmain/public">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

© Server Fault or respective owner

Related posts about apache

Related posts about configuration