The King Ant
08-16-2001, 09:44 PM
Is it possible to use variables in an httpd.conf file? Say I have this:
<VirtualHost 192.168.168.192>
ServerName www.domainname.com (http://www.domainname.com)
ServerAlias domainname.com
DocumentRoot /home/domainname.com/html
</VirtualHost>
Could I instead make a variable equal to "www.domainname.com", and then have something like
<VirtualHost 192.168.168.192>
SetEnv THIS_DOMAIN domainname.com
ServerName www.$THIS_DOMAIN (http://www.$THIS_DOMAIN)
ServerAlias $THIS_DOMAIN
DocumentRoot /home/$THIS_DOMAIN/html
</VirtualHost>
That would make it much easier to add a new virtual host by just copying over that section. I would only have to change 1 line instead of 5 or 6 (with logging, ServerAdmin, etc.)
<VirtualHost 192.168.168.192>
ServerName www.domainname.com (http://www.domainname.com)
ServerAlias domainname.com
DocumentRoot /home/domainname.com/html
</VirtualHost>
Could I instead make a variable equal to "www.domainname.com", and then have something like
<VirtualHost 192.168.168.192>
SetEnv THIS_DOMAIN domainname.com
ServerName www.$THIS_DOMAIN (http://www.$THIS_DOMAIN)
ServerAlias $THIS_DOMAIN
DocumentRoot /home/$THIS_DOMAIN/html
</VirtualHost>
That would make it much easier to add a new virtual host by just copying over that section. I would only have to change 1 line instead of 5 or 6 (with logging, ServerAdmin, etc.)