User login

Who's online

There are currently 0 users and 18 guests online.

Shoutbox

sentono: testing shoutbox :)
sentono: please type something here :)
Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
All Shouts

Recent comments

Syndicate

Syndicate content

How To Configure Apache2 VirtualHost in Ubuntu

What is Apache2 VirtualHost?

Apache2 VirtualHost is use for multidomain purpose. We need to configure 2 VirtualHost name to each domain, so we can see a different website from each domain.

First I assume we have installed apache2 webserver and it's running smootly in Ubuntu Server.

To configure apache webserver VirtualHost in Ubuntu server is different from other linux OS like fedora/redhat/centos. In Ubuntu apache2 have separated the virtual host into sites-available and sited-enabled directory.

Example we have domain inferno.web.id

We need to login into the server and have a root user previleges.
We also need to create a file name inferno.web.id in sites-available directory

sentono@athena:~$sudo su
Password:
root@athena:/home/sentono#

Change directory to /etc/apache2/sites-available/

root@athena:/home/sentono#cd /etc/apache2/sites-available/
root@athena:/etc/apache2/sites-available#

Add NameVirtualHost into Default site

root@athena:/etc/apache2/sites-available#pico default

#change or add this line below

NameVirtualHost 192.168.1.1:80

#save and exit

Create a new virtualhost file

root@athena:/etc/apache2/sites-available#pico inferno.web.id


<VirtualHost 192.168.1.1:80>
ServerName inferno.web.id
DocumentRoot /home/www/inferno.web.id/public_html/
</VirtualHost>


#save this file and exit

We need to enabled our new Website

root@athena:/etc/apache2/sites-available#a2ensite inferno.web.id

Restart Apache2 Webserver

root@athena:/etc/apache2/sites-available#/etc/init.d/apache2 restart

Create testing index.php

root@athena:/etc/apache2/sites-available#nano /home/www/inferno.web.id/public_html/index.php


<? phpinfo() ?>


#save and exit

Testing it with IE

http://inferno.web.id

 





Post new comment

The content of this field is kept private and will not be shown publicly.
  • Use [break] to create page breaks.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <br> <p> <h1> <h2> <h3> <h4> <h5> <pre>
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options

Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
9 + 9 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Donate

Does this site make your life easier? Help me keep it online.

YM! Status