Welcome to Bruces Wiki on Tue 07 of Sep, 2010 [21:25 UTC]

Apache Virtual Hosting

print

Virtual Hosting


Change directories to the sites-enabled directory.

$cd /etc/apache2/sites-enabled/


Create your configuration file

$sudo vi example.com.conf


Add the following;

<VirtualHost dev.example.com>
    ServerAdmin webmaster@localhost
    ServerAlias www.dev.example.com
    DocumentRoot /home/user/public_html/example.com
    ScriptAlias /awstats/ /usr/lib/cgi-bin/
    CustomLog /var/log/apache2/example.com-access.log combined
</VirtualHost>


Create a link in sites-available

$sudo ln -s /etc/apache2/sites-available/example.com.conf example.com.conf


Edit /etc/hosts so that you can use a named server for development.

$sudo vi /etc/hosts


Find the line that starts with 127.0.0.1 when you finished it should look something like this.

127.0.0.1 localhost dev.example.com



Reload Apache.

sudo /etc/init.d/apache2 reload

Created by: admin last modification: Saturday 29 of March, 2008 [06:06:29 UTC] by admin


Login
 
Powered by Tikiwiki the ultimate CMS engine.