nginx and awstats setup

Juan Fco. Giordana juangiordana at gmail.com
Sun Jan 16 18:55:15 MSK 2011


On 01/15/2011 04:51 AM, Ryan B wrote:
> I'm running awstats server stats log from another machine,
>
>      nginx.conf: http://pastebin.com/buKAdfdd
>      cgi-bin.conf: http://pastebin.com/qbbJ1rwK
>
> But I'm getting 404 when I visit (seems to take a while.. then displays
> the 404)
>
> http://domain2.com/awstats/awstats.domain.com.html
>
> (and the 23 files are there..) in /var/www/awstats/
>
> I was following this, but not sure how to resolve the 404's issue,
>
> http://www.goitworld.com/analysis-access-logs-of-nginx-by-awstats/

Hello Ryan,

Your nginx.conf is too tangled. See an easier example:

# stats.example.com
server {
     listen 80;
     server_name stats.example.com;
     access_log /var/log/nginx/stats.example.com-access_log main;
     error_log /var/log/nginx/stats.example.com-error_log;
     root /srv/www/stats.example.com/www;
     index index.html;

     location ~ ^/cgi-bin/(awredir|awstats)\.pl {
         gzip off;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_param SCRIPT_FILENAME $document_root/cgi-bin.php;
         fastcgi_param X_SCRIPT_FILENAME 
/srv/www/stats.example.com/awstats/wwwroot$fastcgi_script_name;
         fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
         include fastcgi_params;
     }
}

$ ls /srv/www/stats.example.com/www/
drwxr-xr-x 2 juan juan 6688 Nov  8  2009 awstats
drwxr-xr-x 2 juan juan  120 Feb 10  2009 css
drwxr-xr-x 9 juan juan  216 Feb 10  2009 icon
drwxr-xr-x 2 juan juan   88 Feb 10  2009 js
-rw-r--r-- 1 juan juan 1072 Feb  7  2010 cgi-bin.php
-rw-r--r-- 1 juan juan  318 Jun  4  2010 favicon.ico
-rw-r--r-- 1 juan juan  886 Feb  7  2010 index.html
-rw-r--r-- 1 juan juan   25 Apr 19  2009 robots.txt

I've followed the awstats installation guide and these steps to get 
awstasts working with FastCGI and so far everything is going well:

http://forum.slicehost.com/comments.php?DiscussionID=2561

Also make sure to add SSL encryption and authentication before going 
live and you should be done.

Regards.



More information about the nginx mailing list