Tuesday 10 January 2012

Apache

Apache in computer technology is defined as a web server software.

Taking it for granted that Apache has already been installed in a ubuntu installed system , the procedure for creating a module and loading it in apache is as follows ,


$ cd /etc/apache2

This is the place were we have the .c version of the newly created modules
now create a module ( here  I have given a name to the module as pracmod3)

$ sudo apxs2 -g -n "pracmod3"

so we have created the module.
now get into the module folder pracmod3 by normal cd command

$ cd pracmod3

Now we have to compile the .c file mod_pracmod3.c

$ sudo apxs2 -c -i mod_pracmod3.c

Now mod_pracmod3.so has been created . This is the dynamic shared object . This is similar to dll files in windows.
Now its our job to load into the apache and this is done by the following sequence of steps

$ cd ..


then open the mod_pracmod3.c and copy that which follows the lines (shown in red here )"Then activate it in Apache's apache2.conf file for instance
for the URL /pracmod3 in as follows: 
#   apache2.conf"
the content to be copied will be as follows

LoadModule pracmod3_module modules/mod_pracmod3.so
<Location /pracmod3>
SetHandler pracmod3


$ sudo vim apache2.conf

now paste the copied content below the line (shown in red here) Include sites-enabled/

now change the path of the file pracmod3.so , to the place where it is there in your system .
In my system it was in 
/usr/lib/apache2/modules

now we have to restart the apache as 

$ sudo apachectl restart

Now , our job is over .
To check whether our module has been loaded properly. check if it displays the content that was in "The sample content handler " portion of mod_pracmod3.c 

to do that type command
$ lynx -mime_header http://localhost/pracmod3 


the result is seen as (shown in red here )
HTTP/1.1 200 OK
Date: Tue, 10 Jan 2012 05:25:55 GMT
Server: Apache/2.2.20 (Ubuntu)
Content-Length: 62
Connection: close
Content-Type: text/html

The sample page from mod_pracmod3.c and it was done by harish




Thank You .









No comments:

Post a Comment