Awstats and nginx

Hi guys, how can allow the use of AWStats as a CGI in nginx? tnks =)

“Alexis Torres Garnica” [email protected]
wrote in message news:[email protected]

Hi guys, how can allow the use of AWStats as a CGI in nginx? tnks =)

You can’t; CGI is not supported by Nginx, therefore you have to run
as FastCGI.


Hi guys,

This is my first post in this mailing list. I have recently installed
nginx, and I find it is really an awesome piece of software!

You have advised Alexis to use fastcgi for PHP following the
documentation in this page:

Although it can handle php, I am not sure it is the best method.

I have used this documentation page to set up fastcgi in nginx to be
able to run a python script. However to make php scripts work, I had
to make my php script (a simple ‘hello world’ test script) executable
and I also had to add #!/usr/bin/cgi-php at the beginning of the php
script in order to have the ‘hello world’ message display in my

Is my setup working correctly? I was wondering whether or not have to
make the script executable was correct, otherwise nginx tells me that
it cannot execute it.

Because if it does, poor Alexis will have to make all AWstats php
scripts executable and moreover he will have to add #!/usr/bin/cgi-php
at the beginning of each file, and this will take some time and might
result in buggy behaviors impossible to spot.

I would rather advise Alexis to setup a php-cgi server, and redirect
php scripts to that server, the following documentation is probably
more what Alexis is looking for:

This way, no need to edit the php files of AWstats.

I am rather new to nginx, so please let me know if what I say is

Best regards,

Using firefox, I keep getting this message when trying to view some
things hosted on an nginx server:

“The connection to the server was reset while the page was loading.”

If I just hit try again, it works fine, but I’m getting complaints from
the one customer I’ve moved over to this server.

When I get this error, nothing shows up in the error logs. I have them
turned up to debug and still nothing shows up.

I’m running the latest stable version 0.5.35 built as a debian package
from the testing branch (lenny).

I’ve tried all kinds of things, and it seems to go away for a while if
I do a server restart.

Has anyone else seen this before? I’d really appreciate any help.


Can you send more info? What request are you sending with Firefox?
What is the salient part of your nginx config that relates to that

Are you proxying to any backends or using fcgi?

Well, the type of request is just whatever firefox sends by default (I’m
assuming GET), I don’t know for sure because nginx never logs anything
when this happens.

The relevant portion of my configs is:

user www-data;
worker_processes 4;

error_log /var/log/nginx/error.log debug;
pid /var/run/;

events {
worker_connections 2048;

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

access_log  /var/log/nginx/access.log;

sendfile        on;
tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

#gzip  on;

include /etc/nginx/sites-enabled/*;


#Then here’s the config for the domain in question (I changed the domain
#name to though.
#Config for

server {
listen 80;

    access_log  /var/log/nginx/example.access.log;

    location / {
            root   /home/customers/example;
            index  index.html;
    location /linkpics/ {
            alias /home/customers/example/linkpics/;
            autoindex on;

    #error_page  404  /404.html;

    # pass the PHP scripts to FastCGI server listening on
location ~ .php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
include /etc/nginx/fastcgi_params;

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    location ~ /\.ht {
            deny  all;


There’s not much there. On that domain, I’m not proxying, just serving
static html and a 2mb flash file. One other domain, I’m doing fastcgi
to another server and it gets the same message in firefox but it happens
more often to that one (it sits and does auto refresh ever 5 min, so
probably only happens more cause it’s constantly refreshing).

Part of me thinks it might be a firewall problem or other networking
thing since nginx doesn’t even log that a connection occurs when it
happens, but I have other servers on the same lan with the same firewall
out front and I’ve never seen this with them (one’s apache and ones
lighttpd). So I don’t know. Mainly I was hoping someone out there has
come across the same problem, or maybe it was a known bug or something.

I really appreciate any help.


Ok…I appologize list…I did some deeper tests and some packet
captures and it looks like a weird network problem. Probably either
the weird iptables setup I have or my stupid hosting provider.

Problem doesn’t seem to be nginx at all…(I’m sure you guys already
figured that much though).

Thanks again for the responses I did get. I appreciate the effort.

Thanks again,

p.s. I love nginx…you need t-shirts with that on it…