Awstats and NGinX

Hi All,
I have recently set-up a new LEMP on Ubuntu 11.10 (64-bit), it is a
pretty simple set-up and all is running fine. That is until I try to
get Awstats working. I have diligently followed the Awstats set up
outlined at

http://blog.rubynginx.com/index.php/2010_01_25/setup-awstats-phpmyadmin-phppgadmin-with-nginx-on-ubuntu/

However, when I enter the URL in a browser I get page not found (404
error).
This is the URL I am entering

http://mydomain.com/cgi-bin/awstats.pl

I have been working at this for a few days now, but being totally new to
Linux…I’m afraid that I don’t know enough to ask the right questions
(or intelligent questions).

Incidently I am having the exact same 404 message when trying to enter
the URL for phpMyAdmin…

Can someone please take the time to help me out??

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220628,220628#msg-220628

Hi,

On 28-12-2011 20:58, DeneB wrote:

Hi All,
I have recently set-up a new LEMP on Ubuntu 11.10 (64-bit), it is a
pretty simple set-up and all is running fine. That is until I try to
get Awstats working. I have diligently followed the Awstats set up
outlined at

http://blog.rubynginx.com/index.php/2010_01_25/setup-awstats-phpmyadmin-phppgadmin-with-nginx-on-ubuntu/

[snipp]

Incidently I am having the exact same 404 message when trying to
enter
the URL for phpMyAdmin…

What’s in your nginx and php error log?
Please can you add a nginx debug output.

http://www.nginx.org/en/docs/debugging_log.html

BR
Aleks

Aleks Thanks for replying…

I am looking at the error log and it is blank, let me check to see the
problem with the log.

I will get back to you on this and then try to config the debug output.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220628,220637#msg-220637

On 29 Dez 2011 01h27 WET, [email protected] wrote:

reading response header from upstream, client: 11.11.1.111, server:
mydomain.com, request: “GET /cgi-bin/awstats.pl HTTP/1.1”, upstream:
“fastcgi://127.0.0.1:49232”, host: “mydomain.com

It seems that there are a few fastcgi parameters that are undefined.

I’ve never used awstats with Nginx, but here’s a previous thread that
might be of use to you:

http://forum.nginx.org/read.php?2,219151,219162#msg-219162

— appa

BINGO! Got the error.log working and I found something! (But don’t
know how to fix it)

This is what I found…

2011/12/28 20:20:51 [error] 19200#0: *9 FastCGI sent in stderr: “PHP
Notice: Undefined index: X_SCRIPT_FILENAME in /etc/nginx/cgi-bin.php on
line 9
PHP Notice: Undefined index: X_SCRIPT_NAME in /etc/nginx/cgi-bin.php on
line 10
PHP Notice: Undefined index: X_SCRIPT_FILENAME in
/etc/nginx/cgi-bin.php on line 12” while reading response header from
upstream, client: 11.11.1.111, server: mydomain.com, request: “GET
/cgi-bin/awstats.pl HTTP/1.1”, upstream: “fastcgi://127.0.0.1:49232”,
host: “mydomain.com

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220628,220638#msg-220638

Finally!!! I have Awstats working!!!

The undefined fastcgi parameter is a result of using ENV in the
cgi-bin.php So I replaced ENV with SERVER and it works!!! So with
Ubuntu 11.10 (64-bit), Awstats, and Nginx 1.05 the cgi-bin.php looks
like this (where it now reads $_SERVER…it used to read $ENV):

<?php $descriptorspec = array( 0 => array("pipe", "r"), //stdin is a pipe that the child will read from 1 => array("pipe", "w"), //stdout is a pipe that the child will write to 2 => array("pipe", "w"), //stderr is a file to write to ); $newenv = $_SERVER; $newenv["SCRIPT_FILENAME"] = $_SERVER["X_SCRIPT_FILENAME"]; $newenv["SCRIPT_NAME"] = $_SERVER["X_SCRIPT_NAME"]; if (is_executable ($_SERVER["X_SCRIPT_FILENAME"])) { $process = proc_open($_SERVER["X_SCRIPT_FILENAME"], $descriptorspec, $pipes, NULL, $newenv); if (is_resource($process)) { fclose($pipes[0]); $head = fgets($pipes[1]); while (strcmp($head, "\n")) { header($head); $head = fgets($pipes[1]); } fpassthru($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); $return_value = proc_close($process); } else { header("Status: 500 Internal Server Error"); echo ("Internal Server Error"); }} else { header("Status: 404 Page Not Found"); echo("Page Not Found"); } ?>

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220628,220641#msg-220641

Antonio Thanks for your help too! Sorry I thought all the replies were
Alek…

Thank-you all!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220628,220643#msg-220643

Alek, Thanks for your help…I haven’t fixed the problem but your
input has highlighted the problem. Now I understand where this is
happening (in the fastcgi parameters) and in what file. If I can
discover why it is undefined then it looks like I’ll have the problem
fixed.

Another note: I think the debug output is on because when I stop nginx
and start again…I have no errors, but before if I had an eror in my
syntex it would tell me what and where.

I’ll read up on the link you gave me, and post my results when I get the
problem fixed.

Thanks again for your help.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220628,220640#msg-220640

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs