httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Browder <tom.brow...@gmail.com>
Subject Re: [users@httpd] dynamic virtual hosts
Date Wed, 12 Mar 2014 19:11:24 GMT
On Wed, Mar 12, 2014 at 2:56 PM, Rose, John B <jbrose@utk.edu> wrote:
> Has anyone used mod_vhost, or mod_rewrite, some other way,  or some
> combination, and implemented in production, dynamic virtual hosts of unique
> hundreds or more,  sub domains.
>
> If so, which method did you use, and can you give us the configuration, or
> some idea, that you used.

I'm not sure this  will help, but I'm using httpd 2.4.7 and just
discovered mod_macro which has greatly simplified my little nest of
vhosts.

Here is one chunk of my httpd.conf where I define one macro for an
SSL/TLS-only server:

LoadModule macro_module modules/mod_macro.so
#### SSL/TLS-ONLY SITES ####
<Macro VHOST_TLS ${DOMAIN} ${TLD}>
  <VirtualHost *:80>
    ServerName  ${DOMAIN}.${TLD}
    ServerAlias www.${DOMAIN}.${TLD}
    # enforce ssl/tls
    Redirect Permanent / https://${DOMAIN}.${TLD}/
  </VirtualHost>

  ##### BEGIN SSL/TLS OPERATIONS #####
  <IfModule mod_ssl.c>
    <VirtualHost *:443>
      SSLEngine on
      ServerName  ${DOMAIN}.${TLD}
      ServerAlias www.${DOMAIN}.${TLD}
      DocumentRoot /home/web-sites/${DOMAIN}.${TLD}/public
      <Directory /home/web-sites/${DOMAIN}.${TLD}/public>
        SSLRequireSSL
      </Directory>
    </VirtualHost>
  </IfModule>
  ##### END SSL/TLS OPERATIONS #####
</Macro>

Use VHOST_TLS domain1      tld1
Use VHOST_TLS domain2      tld2
# ...etc...
Use VHOST_TLS domainN      tldN
UndefMacro VHOST_TLS

Right now they are static hosts but I plan to add multiple Django
sites using macros in a similar manner.

HTH.

Best regards,

-Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message