1

尝试在 nginx ubuntu 上安装 awtats。我遵循了本教程: http: //kamisama.me/2013/03/20/install-configure-and-protect-awstats-for-multiple-nginx-vhost-on-debian/

我收到错误“404 not found”(我还没有设置密码保护)。这是我的 subdomain.conf 文件:

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;
}
}

任何帮助表示赞赏!

编辑:Nginx 调试日志:

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
4

1 回答 1

1

线

fastcgi_param   X_SCRIPT_FILENAME  /usr/lib$fastcgi_script_name;

指向 /cgi-bin/awstats.pl 的位置,在 Debian 上是 /usr/lib/cgi-bin/awstats.pl,但在 RHEL/CentOS 上应该是

fastcgi_param   X_SCRIPT_FILENAME  /usr/share/awstats/wwwroot$fastcgi_script_name;
于 2018-08-20T12:22:10.580 回答