AWstats and nginx
Grzegorz Nosek
grzegorz.nosek at gmail.com
Tue Aug 14 17:59:43 MSD 2007
2007/8/12, Malte Sussdorff <sussdorff at sussdorff.de>:
> I looked in the Wiki and google, but maybe I am too dump to find the
> answer.
>
> If I want to serve awstats Perl CGI pages from NGINX without the need
> to install a separate webserver, is this possible?
>
Have a look at http://www.localdomain.pl/assets/2007/7/29/fcgiwrap.c
You need libfcgi (lib and headers, refer to your distro for details)
and compile it like this:
gcc -Wall -Wextra -Werror -pedantic -O2 fcgiwrap.c -o fcgiwrap -lfcgi
You can run it under a process manager (e.g. spawn-fcgi from lighttpd
if you're desperate ;) ) and simply direct requests to it via
fastcgi_pass.
Important:
* Don't run as root! The wrapper doesn't drop privileges, so beware.
* Absolutely no warranty etc. If it breaks, you get to keep the pieces.
* The wrapper may service only one request at a time, but CGI usually
isn't performance-sensitive anyway :)
* Set up DOCUMENT_ROOT etc. in nginx before passing the request
* You may need to hack around nginx if you want to support PATH_INFO
(/index.cgi/foobar) - I may publish my repo if I find the time
* As far as I tested, it works fine.
HTH,
Grzegorz Nosek
More information about the nginx
mailing list