JSCRB
JSCRB

Reputation: 33

awstats on NGINX

Trying to install awtats on nginx ubuntu. I've followed this tutorial: http://kamisama.me/2013/03/20/install-configure-and-protect-awstats-for-multiple-nginx-vhost-on-debian/

I am getting error "404 not found" (I have not setup password protecting yet either). Here is my subdomain.conf file:

server {
listen 80;
listen [::]:80;

server_name stats.mydomain.com;
root    /home/myname/stats.mydomain.com/public;

error_log /var/log/nginx/stats.mydomain.com.error.log;
access_log off;
log_not_found off;

location ^~ /icon {
    alias /usr/share/awstats/icon/;
}

location ~ ^/([a-z0-9-_\.]+)$ {
    return 301 $scheme://stats.mydomain.com/<cgi-></cgi->bin/awstats.pl?config=$1;
}

location ~ ^/cgi-bin/.*\.(cgi|pl|py|rb) {
    gzip off;
    include         fastcgi_params;
    fastcgi_pass    unix:/run/php/php7.2-fpm.sock;
    fastcgi_index   cgi-bin.php;
    fastcgi_param   SCRIPT_FILENAME    /etc/nginx/cgi-bin.php;
    fastcgi_param   SCRIPT_NAME        /cgi-bin/cgi-bin.php;
    fastcgi_param   X_SCRIPT_FILENAME  /usr/lib$fastcgi_script_name;
    fastcgi_param   X_SCRIPT_NAME      $fastcgi_script_name;
    fastcgi_param   REMOTE_USER        $remote_user;
}
}

Any help is appreciated!

Edit: Nginx Debug log:

accept on 0.0.0.0:80, ready: 1
posix_memalign: 000055E63A681580:512 @16
*9 accept: 173.44.83.13:56389 fd:18
*9 event timer add: 18: 60000:1523240120587
*9 reusable connection: 1
*9 epoll add event: fd:18 op:1 ev:80002001
accept() not ready (11: Resource temporarily unavailable)
*9 http wait request handler
*9 malloc: 000055E63A6ED5E0:1024
*9 recv: eof:0, avail:1
*9 recv: fd:18 534 of 1024
*9 reusable connection: 0
*9 posix_memalign: 000055E63A68D4E0:4096 @16
9 http process request line
*9 http request line: "GET /%3Ccgi-%3E%3C/cgi-%3Ebin/awstats.pl?config=cgi-bin.php HTTP/1.1"
*9 s:0 in:'2F:/'
*9 s:1 in:'25:%'
*9 s:4 in:'33:3'
*9 s:5 in:'43:C'
*9 s:1 in:'3C:<'
*9 s:0 in:'63:c'
*9 s:0 in:'67:g'
*9 s:0 in:'69:i'
*9 s:0 in:'2D:-'
*9 s:0 in:'25:%'
*9 s:4 in:'33:3'
*9 s:5 in:'45:E'
*9 s:0 in:'25:%'
*9 s:4 in:'33:3'
*9 s:5 in:'43:C'
*9 s:0 in:'3C:<'
*9 s:0 in:'2F:/'
*9 s:1 in:'63:c'
9 s:0 in:'67:g'
*9 s:0 in:'69:i'
*9 s:0 in:'2D:-'
*9 s:0 in:'25:%'
*9 s:4 in:'33:3'
*9 s:5 in:'45:E'
*9 s:0 in:'3E:>'
*9 s:0 in:'62:b'
*9 s:0 in:'69:i'
*9 s:0 in:'6E:n'
*9 s:0 in:'2F:/'
*9 s:1 in:'61:a'
*9 s:0 in:'77:w'
*9 s:0 in:'73:s'
*9 s:0 in:'74:t'
*9 s:0 in:'61:a'
*9 s:0 in:'74:t'
*9 s:0 in:'73:s'
*9 s:0 in:'2E:.'
*9 s:0 in:'70:p'
*9 s:0 in:'6C:l'
*9 s:0 in:'3F:?'
*9 http uri: "/<cgi-></cgi->bin/awstats.pl"
*9 http args: "config=cgi-bin.php"
*9 http exten: "pl"
*9 posix_memalign: 000055E63A6E88C0:4096 @16
*9 http process request header line

Upvotes: 1

Views: 3815

Answers (1)

al3xxx
al3xxx

Reputation: 21

The line

fastcgi_param   X_SCRIPT_FILENAME  /usr/lib$fastcgi_script_name;

points to the location of your /cgi-bin/awstats.pl, it's /usr/lib/cgi-bin/awstats.pl on Debian, but on RHEL/CentOS it should be

fastcgi_param   X_SCRIPT_FILENAME  /usr/share/awstats/wwwroot$fastcgi_script_name;

Upvotes: 1

Related Questions