Next Tutorial

Drupal 7 Tutorial Part 19: Understanding Drupal 7 Content Types & Fields Concepts !

How to create Virtual Hosts for Drupal Instance on Linux Ubuntu Local Machine

Submitted by anilsagar on Wed, 06/06/2012 - 11:46

Hi Guys,

Instead of using localhost/sitename if you would like to use domains such as local.sitename.com then follow below process. It will be helpful to avoid basepath in rich text editor links and can avoid basepath issues if any !

Step 1:

            Assume your code resides at /var/www/drupalsite.

Step 2:

           You can access your site using http://localhost/drupalsite.

Step 3: 

          You would like to access same site using http://local.drupalsite.com to solve path issues and wysiywig editor images, and files link issues.

Step 4:

        Open the file in your editor. /etc/apache2/sites-enabled/vhosts.conf

Step 5:

      Edit file with below lines of code.

 

<VirtualHost *:80>
ServerName local.drupalsite.com
ServerAlias www.local.drupalsite.com
DocumentRoot /var/www/drupalsite
</VirtualHost>
 
Step 6:
             Open the file /etc/hosts in your editor.
 
Step 7:
           Add below lines of code.
 
127.0.0.1   local.drupalsite.com
 
Step 8:
          Restart your apache server by running below command using console.
          sudo /etc/init.d/apache2 restart
 
Step 9:
          Access http://local.drupalsite.com to view drupal instance in direct domain.
 
Cheers,
Anil Sagar

2 comments

hello

Submitted by johnny (not verified) on Sat, 07/07/2012 - 01:50.

wow thats great

advanced

Submitted by jane (not verified) on Fri, 07/06/2012 - 06:00.

wow well made website

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.
©2010 AnilSagar. All rights reserved. Drupal theme by Kiwi Themes.