Warning: Table './wowtutorial/cache_page' is marked as crashed and last (automatic?) repair failed query: SELECT data, created, headers, expire, serialized FROM cache_page WHERE cid = 'http://www.wowtutorial.org/tutorial/24.html' in /usr/home/wowtutorial/public_html/includes/database.mysql.inc on line 135

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/wowtutorial/public_html/includes/database.mysql.inc:135) in /usr/home/wowtutorial/public_html/includes/bootstrap.inc on line 729

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/wowtutorial/public_html/includes/database.mysql.inc:135) in /usr/home/wowtutorial/public_html/includes/bootstrap.inc on line 730

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/wowtutorial/public_html/includes/database.mysql.inc:135) in /usr/home/wowtutorial/public_html/includes/bootstrap.inc on line 731

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/wowtutorial/public_html/includes/database.mysql.inc:135) in /usr/home/wowtutorial/public_html/includes/bootstrap.inc on line 732
How To Configure Apache2 VirtualHost in Ubuntu | Wowtutorial

Search

User login

Poll

What is your favorite DB Server ?:
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

My YM

Author Information

sentono
Offline
Last seen: 1 day 9 hours ago
Joined: 09/21/2007

Alexa Rank

Who's online

There are currently 0 users and 69 guests online.
Home
warning: Cannot modify header information - headers already sent by (output started at /usr/home/wowtutorial/public_html/includes/database.mysql.inc:135) in /usr/home/wowtutorial/public_html/includes/common.inc on line 153.

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

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

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

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

Add NameVirtualHost into Default site

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

#change or add this line below

[code]NameVirtualHost 192.168.1.1:80[/code]

#save and exit

Create a new virtualhost file

[code]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 [/code]

We need to enabled our new Website

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

Restart Apache2 Webserver

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

Create testing index.php

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

<? phpinfo() ?>

#save and exit[/code]

Testing it with IE

[code]http://inferno.web.id[/code]

 

Comments

Thank you for this tutorial

This tutorial really help my problems. thank you very much.

thanks for your tutorial my

thanks for your tutorial

my ques. is what's "192.168.1.1" ip refers to ? internal,external of the server..

 

thanks again

192.168.1.1 ip refers to your

192.168.1.1 ip refers to your external ip address.

This is also could be your internal ip address if you are using NAT to your external ip server.

FYI : 192.168.1.1 is just a example ip address so if you want to put the ip address there, you should put your external ip address there

Other tutorials

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Recent comments

Facebook Fans

Sponsors

Tag Cloud