In this post I will show how to configure several virtual hosts on a linux machine, that will function as subdomains with their own DocumentRoots.
Goal:
From now on every 'html' traffic is redirected to your following settings; and have in mind that you former DocumentRoot is overridden.
(the last caused me some troube/time)
Now set up some subdomains:
At last you have to make sure you still can access mysite.com/app1
(in a subfolder of html)
With these settings my server runs problemfree and I am just waiting for my fist rails app to be deployed in order to test the vhost settings for passenger.
Have fun!
Goal:
- access your site via blog.mysite.com
- access a different site via test.mysite.com
- allow different app to be accessable via mysite.com/app1
NameVirtualHost *:80
From now on every 'html' traffic is redirected to your following settings; and have in mind that you former DocumentRoot is overridden.
(the last caused me some troube/time)
Now set up some subdomains:
<VirtualHost *:80>
ServerName blog.mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /var/www/html/blog
<Directory /var/www/html/blog>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName test.mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /var/www/html/test
<Directory /var/www/html/test>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
At last you have to make sure you still can access mysite.com/app1
(in a subfolder of html)
<VirtualHost *:80>
ServerName mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
With these settings my server runs problemfree and I am just waiting for my fist rails app to be deployed in order to test the vhost settings for passenger.
Have fun!
Kommentare
Kommentar veröffentlichen