Saturday, 28 September 2013

Accessing Application outside Virtual Directory in Apache 2

                                            Virtual  Directory in Apache 


Hi  Reader,
This is my  sixth post. I am going to start  how to access application outside the virtual directory in Apache.

In my previous post I have described about Document Root, NameVirtualHost and VirtualHost.

We can access the Application outside the Document Root of the Apache using virtual directory.
Here we are not putting the application inside Apache's Document Root. We can access Application outside the Document Root using virtual directory.

Step 1:
   
  We need to load mod_alias Apache module in order to create the virtual directory. Open the httpd.conf and ensure below line is there.

LoadModule   alias_module   modules/mod_alias.so

If there is a # sign remove proceeding that line. Finally we need to restart the Apache.

Step 2:

 Once Apache mod_alias has been loaded, we will try to create the virtual directory.
Open httpd.conf file and search for the  <IfModule alias_module> tag and insert below lines. Suppose we storing our Application in /home/web/satya1. 
So, below we are creating alias of the virtual directory named as /satya1 and also specify it's physical location as /home/web/satya1.

<IfModule alias_module>
    # Add this line for your virtual directories
     Alias  /satya1  /home/web/satya1
     Alias  /satya2  /home/web/satya2

We can create more than one virtual directory in the same syntax.

Step 3:

We need to configure the virtual directory. We need to add below lines to configure virtual host.

<Directory "/home/web/satya1">
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Finally we need to restart the Apache 2. Make the configuration change effect.


No comments:

Post a Comment

Spring 3 Rest Web Service Batch Update with JQuery & Ajax Integration

                      Spring 3  Rest Web Service Batch Update with JQuery & Ajax Integration Hi     In this blog I will describe the...