Configuring Virtual Hosts in Apache 2.x

Hello friends. Today I am going to tell you about configuring Virtual Hosts in Apache. Firstly, you should know that what are Virtual Hosts? If not, below is definition from Wikipedia:

Virtual hosting is a method for hosting multiple domain names on a computer using a single IP address. This allows one machine to share its resources, such as memory and processor cycles, to use its resources more efficiently.

In simple words, If you want to host multiple websites (domains) on a single server then Virtual Hosting is what you need !!. Lets have some discussion about Virtual hosts, if you don’t like theory you can skip directly to configuration part.

Types of Virtual Hosts:

Virtual hosts can be of two types:

  1. Name-based Virtual Hosts
  2. IP based Virtual Hosts.

Name-based Virtual Hosts:

Name-based virtual hosts use multiple host names for the same webserver IP address. Using this method you can host multiple domains (different host names), even if your server has only one Network Interface Card (NIC) i.e one IP. Web server is configured to provide different website based on host name requested by user. If the user requests directly using IP address of server, then default website is provided.

IP-based Virtual Hosts:

In IP-based Virtual Hosts, each site points to a unique IP address. IP-based Virtual Hosting is useful if your server has more than one NIC /IP’s. In that case you can configure your web server to host different site based on the IP address for which request is coming. This type is Virtual hosting is very rarely used.

Name-based Virtual Hosts Configuration:

Here, I am explaining configuration for Apache 2.x. If you are not using Apache as web server then rest of the post is not useful to you. To configure Name-based Virtual Hosts open your server’s httpd.conf file. Search and uncomment the following line is not already uncommented.

NameVirtualHost *:80

If you are unable to find above line in your configuration then it may be possible that Virtual Hosts settings are defined in separate file. Take a look at include directives defined in the httpd.conf file and try to find the right file. For example- In my case, I found the following line in my httpd.conf file:

Include conf/extra/httpd-vhosts.conf

Add or edit rest of configuration at appropriate place according to your httpd.conf. Note that Virtual Hosts in Ubuntu are handled differently, if you install Apache using Ubuntu repositories. I will explain configuration for Ubuntu later in this topic.

For default website, place its contents under Document Root of your web server. You do not need to configure Virtual host for default website. For websites other that default, enter the following lines in appropriate file.

<VirtualHost *:80>
 DocumentRoot "/var/www/drupal"
 ErrorLog "logs/"
 CustomLog "logs/" common

Here, I am using as host name. Change it to your host name. Also, change the value of DocumentRoot to the path of your Virtual Host web directory i.e directory which you want to server when request comes from the name defined as ServerName. Restart Apache for the configuration to take effect.

IP-based Virtual Hosts Configuration:

For IP-based Virtual Hosts, add following lines in the appropriate file (see above section for selecting file).

DocumentRoot "/var/www/example1"
ErrorLog "logs/"
CustomLog "logs/" common

Do not forget to replace host name and DocumentRoot with your own host name. You can also use IP address in <VirtualHost > directive here. Then restart Apache.

Virtual Hosts configuration in Ubuntu:

If you are using Ubuntu Linux distribution and Apache is installed using Ubuntu repositories. Then to configure Virtual Hosts you have to follow following steps:

  • Open /etc/apache2/apache2.conf file. Be sure that following line is uncommented under Virtual Hosts section.
Include /etc/apache2/sites-enabled/
  • Then create a separate file for each Virtual Host you want to configure in the /etc/apache2/sites-enabled/ folder.
  • Write Virtual Host configurations for each Virtual Hosts in their respective files. Configuration is same as discussed in above sections.
  • Restart your webserver. Following command can do it.
$sudo /etc/init.d/apache2 restart



Installing FreeCAD 0.10 in Ubuntu Lucid

Hello to all. Today I am going to explain the procedure to install FreeCAD 0.10 on Ubuntu Lucid.

Firstly, What is FreeCAD?

FreeCAD is a general purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler, aimed directly at mechanical engineering and product design but also fits in a wider range of uses around engineering, such as architecture or other engineering specialties. It is a feature-based parametric modeler with a modular software architecture which makes it easy to provide additional functionality without modifying the core system.

FreeCAD is based on OpenCasCade, a powerful geometry kernel, features an Open Inventor-compliant 3D scene representation model provided by the Coin 3D library, and a broad python API. The interface is built with Qt. FreeCAD runs exactly the same way on Windows, Mac OSX and Linux platforms.

Simple steps to successfully install and run FreeCAD 0.10-:

  • Install FreeCAD 0.9 using ubuntu repositories.

To do that type the following command on terminal.

$sudo apt-get install freecad

As currently Ubuntu repositories provide FreeCAD 0.9, so above command install FreeCAD 0.9 on your system. You can also use Ubuntu package manager instead of above command.

  • Verify the installation.

To verify the installation run FreeCAD from Applications -> Graphics ->FreeCAD or by giving following command on terminal-:


Note-: Bug in python-pivy package provided by Ubuntu repositories.

If you are unable to draw any 2-D component such as line, circle, rectangle etc. and FreeCAD is giving your errors much likely as shown bolow-:

Error: Draft_line command not found

This means there is a bug in python-pivy package which is used by FreeCAD to draw all 2-D figures. Next step will explain how to remove this bug. If you are not facing this type of error may be Ubuntu has resolved this issue then you can skip the next step.

  • Resolving buggy python-pivy error

Firstly, remove existing python-pivy package with this command.

$ sudo apt-get remove python-pivy

Now, download the latest python-pivy package from debian. Download the package appropriate for your CPU architecture from the link below-:

Download python-pivy

Install this .deb package by double clicking on it or by this command-:

$ dpkg -i python-pivy*.deb

  • Install FreeCAD 0.10

I have experienced some problems with FreeCAD 0.9, one is the shape of circle is not perfectly round. So it would be better to use FreeCAD 0.10 and stay updated. For that, download FreeCAD 0.10 (.deb package) from following link-:

FreeCAD from

Be sure to download .deb package available under FreeCAD Linux.

Now remove existing FreeCAD 0.9 package with this command-:

$ sudo apt-get remove freecad

At last, install the downloaded FreeCAD 0.10 .deb package by double clicking on it or via following command-:

$sudo dbpkg -i freecad_*.deb

Now run the new FreeCAD installation and Enjoy.

Have Fun !!.