One of my friends had trouble configuring Apache2 on Ubuntu. I suggested my friend these steps to fix the problem. Configuring Virtual host in Apache2 is very straight forward. It is easy to find what you need in Ubuntu documentation. The below link clearly explains how to configure Apache2.
https://help.ubuntu.com/7.04/server/C/httpd.html
These are the least steps required to configure virtual host in Apache2. If you run into problems please refer the online Ubuntu documentation or Apache2 documentation.
To install Apache use the command
"sudo apt-get install apache2"
Apache2 configuration file in Ubuntu is usually found in this location /etc/apache2/apache2.conf.
The path is different from Redhat, Centos, and other distributions.
Apache is configured by placing directives in plain text configuration files. Apache2 ships with a virtual-host-friendly default configuration. It is configured with a single default virtual host
If you wish to configure a new virtual host or site, copy /etc/apache2/sites-available/default file into the same directory with a new name. For example,
"sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mynewsite"
Edit the new file to configure the new site
To start using New Virutal Host we have to modify at least two directives.
1. ServerName (Put your domain name here)
2. DocumentRoot (path to website)
The /etc/apache2/sites-available directory is not parsed by Apache2. Symbolic links in /etc/apache2/sites-enabled point to "available" sites. Use the a2ensite (Apache2 Enable Site) utility to create those symbolic links.
Change the directory to
"cd /etc/apache2/sites-enabled"
"sudo a2ensite mynewsite"
Similarly, the a2dissite utility should be used to disable sites.
We should be all set to run apache2 server in Ubuntu.
The above configuration will work only if certain modules are enabled. Usually the required modules are available in the default apache2 configuration file.
Post new comment