dubstep
November 27, 2011, 8:00pm
1
Hello,
i try to implement a awstats.pl for every vhost on my nginx
installation.
I tried it the following:
location ~ ^/awstats/ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/awstats.pl;
}
I think i’m to stupid for the location part, it works fine with .pl$
but not with a path, it would be nice to could configure a “directoy”
like /awstats/ in every vhost and then runs the awstats.pl through the
socket (socket is working), but not the SCRIPT_FILENAME-part.
I only found documentions with a php-application who runs the
perl-file.
Thanks
Posted at Nginx Forum:
Veerle
November 27, 2011, 8:07pm
2
On 27 Nov 2011 18h59 WET, [email protected] wrote:
fastcgi_pass unix:/var/run/fcgiwrap.socket;
perl-file.
Thanks
Try:
location = /awstats.pl {
root /usr/lib/cgi-bin;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
# Not needed if already in fastcgi_params.
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
— appa
Veerle
November 27, 2011, 11:26pm
3
Thanks, works fine this way.
One question about the root-part.
Atm i have the root part inside the server {} like:
server {
…
root /xxx/xxx/xxx/
lcoation / {}
}
But now i need to set the root inside the location, but it seems i can’t
override it. Do i really need to remove the root-line from the main
server-part and add it to every location?
Thanks
Posted at Nginx Forum:
Veerle
November 27, 2011, 11:38pm
4
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:
Veerle
November 27, 2011, 11:48pm
5
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:
But i only get a 403 as error.
Thanks
Posted at Nginx Forum:
Re: Perl - awstats.pl config
nginx mailing list
[email protected]
nginx Info Page
–
Cyril “Davromaniak” Lavier