Results 1 to 2 of 2
Hi everybody, I am looking to see if there is a way to have a dynamic <VirtualHost> directive. What I have is a local development box that I have several ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-18-2005 #1
- Join Date
- Mar 2005
The way I have it setup now is a line (e.g include conf/sub.domain.com) in the httpd.conf for each subdomain used by the server. In the file sub.domain.com I have the following
<VirtualHost 192.168.1.254:80> ServerAdmin firstname.lastname@example.org ServerName sub.domain.com DocumentRoot /www/html/sub.domain.com ErrorLog /www/logs/sub.domain.com-error_log CustomLog /www/logs/sub.domain.com-access_log common </VirtualHost>
This works fine for each file and a corresponding line in the httpd.conf file. What I want is only one VirtualHost directive and a dynamic way to have the domain be put in place of sub.domain.com.
Anybody know of a way or ways?
- 06-19-2005 #2
- Join Date
- Jan 2005
Im not sure there is a way to do this im afraid, although ive never really looked at it like that. If i see it correctly, Apache looks down the list of virtual servers until it finds one that compares with the headers supplied from the users' client (the browser!), hence the warning about old (very old!) browsers in the name based virtual hosts section of the apache manual. SO, you need to have something specified in the ServerName section.