11-Degrees

Adding Vhost on Apache2

Posted in Tech by Yoshi on September 30, 2009

Open your favorite text editor then add the code  below, Save it under /etc/apache2/sites-available/localdomain.conf
note you can use any filename you want but for this example we will use localdomain.conf

<VirtualHost *>
ServerName localdomain.dev
DocumentRoot /home/user/public_html
</VirtualHost>

Now we need to add it to our hosts lists, again open your text editor then edit /etc/hosts file, add the code below to the list

127.0.0.1 localdomain.dev

To enable your new domain execute this command

sudo a2ensite localdomain.conf

Then reload apache

sudo /etc/init.d/apache restart

To test if its working, open a browser then point it to this addresss

http://localdomain.dev/

Advertisement
Tagged with: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.