Wednesday, March 26, 2014

CGI in an AOLServer World

After a day and a half of attempting to install awstats, a free log analysis tool in aolserver I came across a forum post that seemed promising, however the link mentioned by the poster was  dead.  Awstats must be installed in the cgi-bin, a somewhat antiquated installation method that truthfully I must admit I have never before attempted. However, a short skip and a jump through archive.org later and I had a cached version of the quoted weblink. This website while not altogether different from others I had found on google, gave me the push I needed to reorganize the code in my nsd.tcl file corresponding to cgi-bin setup. Here is the solution I found to enabling cgi-bin scripts usage in aolserver.




Some assumptions, if you are hoping to get the same results I did
  • You are running at least version 4.5.1 of Aolserver
  • Running at least postgres 9.3.1
  • Have perl installed
ns_section "ns/server/${server}/module/nscgi"
       ns_param  Map "GET  /cgi-bin ${serverroot}/cgi-bin"
       ns_param  Map "POST /cgi-bin ${serverroot}/cgi-bin"
       ns_param  Interps CGIinterps

ns_section "ns/interps/CGIinterps"
       ns_param .pl "/usr/bin/perl"

You will also want to ensure that the following line is uncommented in your nsd.tcl file:
    ns_param   nscgi              ${bindir}/nscgi.so

It is very important that you:
  •  capitalize the word "Map" in the "ns_param Map" section 
  • that the cgi-bin mapping whatever you decide to call it, not have a trailing '/'.
If you still have problems getting it to work, try changing the path from a dynamic path like 
"${serverroot}/cgi-bin" to a static path.

This solved my problems, and awstats has been working great, feel free to shoot me a comment if you feel this posting is incomplete.