Results 1 to 2 of 2
Thread: Dynamic <VirtualHosts>
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 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?
- 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.