Skip navigation.

Configure Virtual Hosts Using Apache And Ubuntu

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.



Cannot find .htaccess file

Hi Bhargi,

I just installed Drupal using Fantastico.

But I am not able to find any .htaccess files or httpd.conf file where i can disable this register_globals and the status report reads the error message as given below.

register_globals is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when register_globals is enabled. The PHP manual has instructions for how to change configuration settings.

Can you help me out with this?

and also i am not sure what this is - Drupal core update status -
There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information.

Answer to your question

Cannot access host from client side.

hello,
I have configured virtual host in server side. It runs on server side but cannot access this host from clent side. I have enter IP HostName on client's windows host file but cannot access host.

Re: Cannot access host from client side.

Hi,

Can you provide us more details about it? Which distribution are you using? What happens when you try to access the virtual host? Are you able to access the virtual hosts from any web browser on the server? Are you running DNS service?

Configuring Virtual Hosts With Apache And Fedora

Hi Bhargi,

Your post inspired me to blog on how to configure Virtual Hosts using Apache on Fedora.

http://lampcomputing.com/node/40

I'm eager to hear comments on the blog post from our friends.

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.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Use the special tag [adsense:format:group:channel] or [adsense:block:location] to display Google AdSense ads.

More information about formatting options

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