# Nginx and awstats setup

**URL:** <https://www.ruby-forum.com/t/nginx-and-awstats-setup/201823>\
**Category:** NGINX\
**Created:** [January 15, 2011, 8:53am UTC](https://www.ruby-forum.com/t/nginx-and-awstats-setup/201823 "2011-01-15T08:53:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 15, 2011, 8:53am UTC](https://www.ruby-forum.com/t/nginx-and-awstats-setup/201823/1 "2011-01-15T08:53:13Z")

</div>

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/](http://www.goitworld.com/analysis-access-logs-of-nginx-by-awstats/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 16, 2011, 4:57pm UTC](https://www.ruby-forum.com/t/nginx-and-awstats-setup/201823/2 "2011-01-16T16:57:14Z")

</div>

On 01/15/2011 04:51 AM, Ryan B wrote:

> (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/](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](http://stats.example.com)

server {  
listen 80;  
server\_name [stats.example.com](http://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](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.
