To install mod_sitestory.c module on Apache2 we need Apache's apxs to compile it.
1. Skip this section, if the apxs tool is already installed on your
system.
[ludab@lanlproto ~]$ sudo yum install httpd-devel [sudo] password for ludab: Loaded plugins: fastestmirror, presto, refresh-packagekit Loading mirror speeds from cached hostfile updates/metalink | 1.7 kB 00:00 * fedora: mirror.cse.iitk.ac.in * rpmfusion-free: mirror.us.leaseweb.net * rpmfusion-free-updates: mirror.us.leaseweb.net * rpmfusion-nonfree: mirror.us.leaseweb.net * rpmfusion-nonfree-updates: mirror.us.leaseweb.net * updates: mirror.cse.iitk.ac.in rpmfusion-free-updates | 3.3 kB 00:00 rpmfusion-nonfree-updates | 3.3 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package httpd-devel.x86_64 0:2.2.17-1.fc13.1 set to be installed --> Processing Dependency: apr-util-devel for package: httpd-devel-2.2.17-1.fc13.1.x86_64 --> Processing Dependency: apr-devel for package: httpd-devel-2.2.17-1.fc13.1.x86_64 --> Running transaction check ---> Package apr-devel.x86_64 0:1.4.5-1.fc13 set to be installed --> Processing Dependency: apr = 1.4.5-1.fc13 for package: apr-devel-1.4.5-1.fc13.x86_64 ---> Package apr-util-devel.x86_64 0:1.3.12-1.fc13 set to be installed --> Processing Dependency: apr-util = 1.3.12-1.fc13 for package: apr-util-devel-1.3.12-1.fc13.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.4.5-1.fc13 set to be updated --> Processing Dependency: apr-util = 1.3.10-1.fc13 for package: apr-util-ldap-1.3.10-1.fc13.x86_64 ---> Package apr-util.x86_64 0:1.3.12-1.fc13 set to be updated --> Running transaction check ---> Package apr-util-ldap.x86_64 0:1.3.12-1.fc13 set to be updated --> Finished Dependency Resolution Dependencies Resolved =======================================================================================================================================================================================
Package Arch Version Repository Size =======================================================================================================================================================================================
Installing: httpd-devel x86_64 2.2.17-1.fc13.1 updates 143 k Installing for dependencies: apr-devel x86_64 1.4.5-1.fc13 updates 179 k apr-util-devel x86_64 1.3.12-1.fc13 updates 70 k Updating for dependencies: apr x86_64 1.4.5-1.fc13 updates 97 k apr-util x86_64 1.3.12-1.fc13 updates 80 k apr-util-ldap x86_64 1.3.12-1.fc13 updates 16 k Transaction Summary =======================================================================================================================================================================================
Install 3 Package(s) Upgrade 3 Package(s) Total download size: 585 k Is this ok [y/N]: y Downloading Packages: Setting up and reading Presto delta metadata Processing delta metadata Download delta size: 97 k (1/3): apr-1.3.9-3.fc13_1.4.5-1.fc13.x86_64.drpm | 55 kB 00:01 (2/3): apr-util-1.3.10-1.fc13_1.3.12-1.fc13.x86_64.drpm | 28 kB 00:00 (3/3): apr-util-ldap-1.3.10-1.fc13_1.3.12-1.fc13.x86_64.drpm | 14 kB 00:05 Finishing rebuild of rpms, from deltarpms <delta rebuild> | 193 kB 00:01 Presto reduced the update size by 50% (from 193 k to 97 k). Package(s) data still to download: 392 k (1/3): apr-devel-1.4.5-1.fc13.x86_64.rpm | 179 kB 00:02 (2/3): apr-util-devel-1.3.12-1.fc13.x86_64.rpm | 70 kB 00:00 (3/3): httpd-devel-2.2.17-1.fc13.1.x86_64.rpm | 143 kB 00:02 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 52 kB/s | 392 kB 00:07 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Updating : apr-1.4.5-1.fc13.x86_64 1/9 Updating : apr-util-1.3.12-1.fc13.x86_64 2/9 Installing : apr-devel-1.4.5-1.fc13.x86_64 3/9 Updating : apr-util-ldap-1.3.12-1.fc13.x86_64 4/9 Installing : apr-util-devel-1.3.12-1.fc13.x86_64 5/9 Installing : httpd-devel-2.2.17-1.fc13.1.x86_64 6/9 Cleanup : apr-util-ldap-1.3.10-1.fc13.x86_64 7/9 Cleanup : apr-util-1.3.10-1.fc13.x86_64 8/9 Cleanup : apr-1.3.9-3.fc13.x86_64 9/9 Installed: httpd-devel.x86_64 0:2.2.17-1.fc13.1
Dependency Installed: apr-devel.x86_64 0:1.4.5-1.fc13 apr-util-devel.x86_64 0:1.3.12-1.fc13
Dependency Updated: apr.x86_64 0:1.4.5-1.fc13 apr-util.x86_64 0:1.3.12-1.fc13 apr-util-ldap.x86_64 0:1.3.12-1.fc13
Complete! [ludab@lanlproto ~]$
2. Check where the apxs is installed by executing: "locate apxs", in this case it is the standard location such as "/usr/sbin/apxs"
[ludab@lanlproto projects]$ ls -la /usr/sbin/apxs -rwxr-xr-x. 1 root root 22085 Oct 27 2010 /usr/sbin/apxs
1 . For the purposes at hand, we proceed to install mod_sitestory.c module:
sudo /usr/sbin/apxs -c -i –acs mod_sitestory.c [sudo] password for ludab: /usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -c -o mod_sitestory.lo mod_sitestory.c && touch mod_sitestory.slo mod_sitestory.c: In function ‘myta_register_hooks’: mod_sitestory.c:519: warning: implicit declaration of function ‘ap_hook_post_read_request’ mod_sitestory.c: At top level: mod_sitestory.c:61: warning: ‘threaded_mpm’ defined but not used /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_sitestory.la -rpath /usr/lib64/httpd/modules -module -avoid-version mod_sitestory.lo –a /usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_sitestory.la /usr/lib64/httpd/modules /usr/lib64/apr-1/build/libtool --mode=install cp mod_sitestory.la /usr/lib64/httpd/modules/ libtool: install: cp .libs/mod_sitestory.so /usr/lib64/httpd/modules/mod_sitestory.so libtool: install: cp .libs/mod_sitestory.lai /usr/lib64/httpd/modules/mod_sitestory.la libtool: install: cp .libs/mod_sitestory.a /usr/lib64/httpd/modules/mod_sitestory.a libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_sitestory.a libtool: install: ranlib /usr/lib64/httpd/modules/mod_sitestory.a libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n /usr/lib64/httpd/modules ---------------------------------------------------------------------- Libraries have been installed in: /usr/lib64/httpd/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- chmod 755 /usr/lib64/httpd/modules/mod_sitestory.so
[ludab@lanlproto conf]$ cd /etc/httpd/conf
3. Adding LoadModule directive to the httpd.conf, if apxs installation
(step 1) did not update the httpd.conf.
#
# Dynamic Shared Object (DSO)
Support
#
# To be able to use the functionality of a module which was built
as a DSO
you
# have to place corresponding `LoadModule' lines at this location
so
the
# directives contained in it are actually available _before_ they
are
used.
# Statically compiled modules (those listed by `httpd -l') do not
need
# to be loaded
here.
#
#
Example:
# LoadModule foo_module
modules/mod_foo.so
#
...
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule sitestory_module modules/mod_sitestory.so
4. Reboot the Apache server :
[ludab@lanlproto conf]$ sudo service httpd stop [sudo] password for ludab: Stopping httpd: [ OK ] [ludab@lanlproto conf]$ sudo service httpd start Starting httpd: [ OK ]
1. Note that the directory where Apache2 is installed on your system can differ.
cd /etc/httpd
we keep our virtual host config files in config.d directory
[ludab@lanlproto httpd]$ ls conf conf.d logs modules run
2. I added to the lanlsource.conf ( our virtual host
lanlsource.lanl.gov config file) configuration snippet for the mod_sitestory
module.
# BEGIN lanlsource.lanl.gov <VirtualHost *:80> #.... ServerName lanlsource.lanl.gov ErrorLog logs/lanlsource_error_log LogLevel debug # ..... <IfModule sitestory_module>I also added LogLevel debug directive to the configuration. It is temporary to check that mod_sitestory is working fine.
EnableArchiving On
ArchiveHost www.resourcedepot.org
ArchivePort 80
ArchivePath /1/put/
ArchiveTimeGate www.resourcedepot.org/1/timegate/
EnableIP On
Excluded /search /test </IfModule>
3. Reboot the server
[ludab@lanlproto conf]$ sudo service httpd stop [sudo] password for ludab: Stopping httpd: [ OK ] [ludab@lanlproto conf]$ sudo service httpd start Starting httpd: [ OK ]
4. To test, access some page in you server:
curl http://lanlsource.lanl.gov
5. Check your Apache log that mod_sitestory is logging messages.
the verbose debugging message from the log file ( in our case
lanlsource_error_log at /etc/httpd/logs) will have similar output as shown
below:
[Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(224): [client 204.121.6.37] mod_sitestory: in headers request 204.121.6.37 [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(225): [client 204.121.6.37] mod_sitestory: in headers request GET /hello HTTP/1.1\r\nUser-Agent:Mozilla/5.0 (X11; U; Linux;en-US)\r\n
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n
Accept-Encoding:gzip\r\nConnection:Keep-Alive\r\nHost:lanlsource.lanl.gov\r\nX-Client-IP:204.121.6.37\r\n [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(228): [client 204.121.6.37] mod_sitestory: in headers request /hello [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(301): [client 204.121.6.37] mod_sitestory: fisrst chunk:PUT /1/put/http://lanlsource.lanl.gov/hello HTTP/1.1\r\nHost: www.resourcedepot.org\r\nConnection: close\r\nTransfer-Encoding: chunked\r\n\r\n10c\r\nGET /hello HTTP/1.1\r\nUser-Agent:Mozilla/5.0 (X11; U; Linux;en-US)\r\n
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n
Accept-Encoding:gzip\r\nConnection:Keep-Alive\r\nHost:lanlsource.lanl.gov\r\nX-Client-IP:204.121.6.37\r\n\r\n\r\n\r\n [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(337): [client 204.121.6.37] mod_sitestory: mod_ta_out3 (data-HEAP): 438 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(391): [client 204.121.6.37] mod_sitestory: length from nbytes:438 [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(337): [client 204.121.6.37] mod_sitestory: mod_ta_out3 (data-IMMORTAL): 10 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(391): [client 204.121.6.37] mod_sitestory: length from nbytes:10 [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(337): [client 204.121.6.37] mod_sitestory: mod_ta_out3 (data-HEAP): 1674 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(391): [client 204.121.6.37] mod_sitestory: length from nbytes:1674 [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(337): [client 204.121.6.37] mod_sitestory: mod_ta_out3 (data-POOL): 8 bytes [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(391): [client 204.121.6.37] mod_sitestory: length from nbytes:8 [Sun Feb 12 06:00:01 2012] [debug] mod_sitestory.c(337): [client 204.121.6.37] mod_sitestory: mod_ta_out3 (metadata-EOS): 0 bytes
After checking your log and conforming that the module is sending HTTP PUT requests, you can comment out that #LogLevel debug to avoid stress on the server