From: Lloyd Zusman Date: 2005-02-22T08:12:39+09:00 Subject: WEBrick: Virtual hosts and inherited directory mappings I posted the following query to the webrick mailing list, but that list has not been very active lately, and so I'm also posting it here, in the hopes of reaching more WEBrick users: I'm using the virtual host mechanism of WEBrick, and I'm trying to make use of shared directories. I'm not sure what is the best way to do this, and I'm wondering if you folks could give me recommendations. Here's what I'm doing: I create a main server which is an instance of WEBrick::HTTPServer. Then, I create a number servers for my virtual hosts. Each of these is is also an instance of WEBrick::HTTPServer. I then use the #virtual_host method to connect these to the main server. I want these virtual hosts to inherit directory mappings from the main server, or from some sort of central resource. For example: mappings for main server (mainserver.com): /img => /var/www/img /icons => /var/www/icons mappings for virtual host 1 (virthost1.com): /img => /var/www/virthost1/img mappings for virtual host 2 (virthost2.com): /icons => /var/www/virthost2/icons mappings for virtual host 3 (virthost3.com): [none] Summary: I want virtual host 1 to inherit the /icons mapping from the main server. I want virtual host 2 to inherit the /img mapping from the main server. I want virtual host 3 to inherit both the /img and /icons mappings from the main server. In other words: mainserver.com/img => /var/www/img mainsercer.com/icons => /var/www/icons virthost1.com/img => /var/www/virthost1/img virthost1.com/icons => /var/www/icons virthost2.com/img => /var/www/img virthost2.com/icons => /var/www/virthost2/icons virthost3.com/img => /var/www/img virthost3.com/icons => /var/www/icons I don't want to have to specify the inherited mappings for each virtual host. That way, if I happen to change the mappings for the main server, these changes will automatically be seen and used by the virtual hosts. How would you folks recommend that I do this via webrick? Thanks in advance. -- Lloyd Zusman ljz@asfast.com God bless you.