i am trying to do both: server dynamic hosts, and have a default site at localhost.Hi, actually your description of you want to achieve, and what already works is a bit confusing. Do you want to serve the dynamic hosts only, or do you have an additional default site?
ok, makes sense after reading your comments.More comments inline. On Wednesday 06 May 2009 04:04:39 wayne wrote: > enable mass/dynamic virtual hosts, allowing each virtual host to be > accessed via example.com AND www.example.com, without creating a > VirtualHost directive for each host. > > NameVirtualHost * This is not needed for dynamic vhosts, and has no influence on the configuration that is outside any vhost directive.
only the domain works, not www.domain.> UseCanonicalName Off > VirtualDocumentRoot /var/www/sites/%0/www > VirtualScriptAlias /var/www/sites/%0/cgi-bin > > which works fine. i can access all the sites listed in /var/www/sites/ > (once they are added to /etc/hosts of course, in both their > www.example.com and example.com forms). So at that point, what does work? Only the domain, or also the www.domain?
Eureka! ok, yes, the solution for the www. problem was to use the directory interpolation you suggested. so now, apache serves for both example1.org AND www.example1.org using a single directory in the /var/www/sites directory. thanks! so simple, sorry i missed that. i though the answer lay in some directive. now on to problem 2...I assume that the latter does not work. You have two ways: 1. change the directory interpolation of the VirtualDocumentRoot and VirtualScriptAlias e.g. to /var/www/sites/%-2.0.%-1 that means the directory name is the second last domain part, a dot, and then the last domain part. This enables www.domain as well as any subdomain that resolves to your apache. 2. simply symlink the domain directory, e.g. www.domain.tld -> domain.tld and leave the directory interpolation as is.
i agree, but i was desperate! your interpolation solution above made this attempt to setup a default configuration unnecessary. danke/thanks again!> then, i attempt to make a > VirtualHost directive for the default host that lists the alias: > > <VirtualHost *> > ServerName default > ServerAlias www.* wildcards are only supported for the first domain part of the alias AFAIK. > DocumentRoot /var/www/ I think it is a bad idea to have (Virtual)DocumentRoots of hostzs overlap each other.
i was hoping both?> </VirtualHost> > unfortunately this does nothing. the virtual hosts are only accessible > via their domain names WITHOUT the www. prefix. What is this this VHost supposed to do? Define the default site, or provide common configuration for the dynamic vhosts?
ok, again makes sense after reading your comments.The latter thas not work at all, dynamic vhosts have nothing to do with a <VirtualHost> container.
ok, that also makes sense. however, i have removed all NameVirtualHost and VirtualHost directives. now, the dynamic virtual hosting still works, but the default sites of localhost / 127.0.0.1 still do not work (i.e. http://localhost and http://127.0.0.1 both return 404). both of these domains work if dynamic virtual hosting is disabled. i also tried setting a "default" DocumentRoot in http.conf, with the same results. any other ideas? i even tried making a "localhost" directory in the /var/www/sites/ directory, still with no luck.You also cannot define ServerAliases for the dynamic vhosts at all, use directory interpolation or symlinks as described above. > in addition, i can no longer access the default DocumentRoot via > localhost or 127.0.0.1. Sure, you defined NameVirtualHost * and <VirtualHost *>. All requests are directed to VHosts, none reaches the main server configuration
i mainly will be using dynamic hosts, though i would like to have the default localhost site work (if possible) as well. also, i was hoping to be able to customize certain dynamic virtual hosts with specific VirtualHost directives.> here are my details: running Apache/2.2.8 (Ubuntu) Mar 10 2009 18:09:05 > on Ubuntu Hardy 8.04 with kernel 2.6.24-23 and all latest updates > applied. i have tried it with/without the default "sites-enabled" > Debian config, to no luck. If you use the debian package, I'd recommend using its site configuration mechanism, it is quite convenient. If you only need the dynamic vhosts, put the config in the default site. If you have one or more other sites, put the dynamic vhosts inside a <VirtualHost> with a specific IP address.
Rainer --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx