Monday, June 13, 2011

Name based virutal host

Creating new site

        Create a file /etc/apache2/sites-available/example.com like
       
        ServerAdmin webmaster@example.com
        ServerName example.com
        ServerAlias www.example.com

        <VirtualHost *>
                ServerAdmin webmaster@example.com
                ServerName example.com
                ServerAlias www.example.com

                DocumentRoot /home/srw/example.com
                <Directory /home/srw/example.com>
                        Options Indexes MultiViews
                        AllowOverride None
                        Order allow,deny
                        allow from all
                </Directory>
        </VirtualHost>


Enabling the site

mkdir /home/srw/example.com
chown www-data /home/srw/example.com
a2ensite example.com
apache2ctl configtest
/etc/init.d/apache2 reload

Ref : http://www.debian-administration.org/articles/285

        http://www.debianhelp.co.uk/virtualhosts.htm
        http://www.techmongrel.com/05/setting-up-a-virtual-host-using-apache-2-on-ubuntu-710/

No comments:

Post a Comment