kallin Posted August 25, 2007 Share Posted August 25, 2007 After hours of unsuccessful attempts I'm out of ideas and I'm hoping someone here can help. I would like to create VirtualDocumentRoots for my growing arsenal of sites. I'm trying to get: http://localhost/websiteA to have a document root of C:/www/websiteA http://localhost/websiteB to have a document root of C:/www/websiteB http://localhost/websiteC to have a document root of C:/www/websiteC and etc... I've tried dozens of different syntax combinations and nothing has worked. Maybe someone here is more familiar with it than I am? Quote Link to comment Share on other sites More sharing options...
trq Posted August 26, 2007 Share Posted August 26, 2007 The three sites you have are all on the same domain, hence, they all use the same DocumentRoot. You need to look up the documentation for vhosts and setup a different vhost for each site using a different hostname/domain. At its simplest, you might have something like.... NameVirtualHost * # This is the default host. <VirtualHost *> DocumentRoot "/var/www/default" </VirtualHost> # Second site. <VirtualHost site1> DocumentRoot "/var/www/site1" </VirtualHost> # Third site. <VirtualHost site2> DocumentRoot "/var/www/site2" </VirtualHost> To get to these site you would use the addresses http://localhost http://site1 http://site2. You will also most likely need to edit your systems hosts file to ensure your browser does not attempt to resolve these host names via DNS. Quote Link to comment Share on other sites More sharing options...
scorour Posted September 14, 2007 Share Posted September 14, 2007 I am a beginner but was wanting similar to what you want, I went for the following: A wildcard DNS to catch all <app1>.server then the following within vhosts of apache: <VirtualHost *:80> RewriteEngine On ServerAlias *.server ScriptAlias /cgi-bin "/usr/local/apache2.2.0a/cgi-bin" RewriteRule ^/(.*) http://%{HTTP_HOST}:5081/$1 [proxy] </VirtualHost> VirtualHost *:5081> CheckSpelling On AddOutputFilterByType DEFLATE text/html text/plain text/xml VirtualDocumentRoot /live/code/html/%1 Alias /common /live/code/html/%1 <Directory /live/code/html> Options Includes Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny Allow from all </Directory> therefore if you enter http://app1.server in your browser, the virtual document root will be /live/code/html/app1 It uses the 1st part of the servername as the subdir from /live/code/html I redirect to port 5081 in this case, as I have other apps on other ports. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.