Perl - awstats.pl config
Cyril Lavier
cyril.lavier at davromaniak.eu
Sun Nov 27 22:48:16 UTC 2011
Hi Veerle.
I don't know if this will help you, but I also run an awstats with
nginx, and here is how I managed to make it work.
First, I made a symlink from /var/www/stats/awstats to /usr/lib/cgi-bin
Then, here is the configuration file (it's a virtual host) :
server {
listen 80;
listen [::]:80;
server_name stats.yourwebsite.tld;
access_log /var/log/nginx/stats.yourwebsite.tld.access.log combined;
error_log /var/log/nginx/stats.yourwebsite.tld.error.log;
root /var/www/stats;
location ^~ /awstats-icon {
alias /usr/share/awstats/icon/;
access_log off;
}
location ^~ /awstatscss {
alias /usr/share/doc/awstats/examples/css/;
access_log off;
}
location ^~ /awstatsclasses {
alias /usr/share/doc/awstats/examples/classes/;
access_log off;
}
location ~ ^/.*\.pl$ {
gzip off;
fastcgi_pass unix:/tmp/cgi.sock;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME
/var/www/stats$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REMOTE_USER $remote_user;
}
}
Then, you will be able to access your awstats by
http://stats.yourwebsite.tld/awstats/awstats.pl
And don't hesitate to add authentication.
Thanks.
On 11/27/2011 11:37 PM, Veerle wrote:
> Hello again, just tried something like that:
>
> location = /cgi-bin/awstats.pl {
> root /usr/lib/cgi-bin;
> gzip off;
> include /etc/nginx/fastcgi_params;
> fastcgi_pass unix:/var/run/fcgiwrap.socket;
> fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/awstats.pl;
> }
>
> But i only get a 403 as error.
>
> Error message is:
> *415 FastCGI sent in stderr: "Cannot get script name, is DOCUMENT_ROOT
> and SCRIPT_NAME set and is the script executable?" while reading
> response header from upstream, client: 80.24.x.x, server: test, request:
> "GET /cgi-bin/awstats.pl HTTP/1.1", upstream:
> "fastcgi://unix:/var/run/fcgiwrap.socket:",
>
> And why is the root-part needed? SCRIPT_FILENAME is not enough?
>
> Thanks
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,219151,219161#msg-219161
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
--
Cyril "Davromaniak" Lavier
More information about the nginx
mailing list