I am using Awstats for many years and before my upgrade on Debian 10, everything was working fine.
I have a special configuration with an Apache2 server behind a Zope framework. I apply rewrite rules from Apache2 to forward request to Zope.
Here my configuration for Apache2 (this file is called vhost.conf
):
<VirtualHost *:443>
# Test local
ServerAdmin henry@example.com
ServerName example.com
ServerAlias www.example.com
# LOG
CustomLog /var/log/apache2/access.log combined
#CustomLog /var/log/apache2/access.log common
# ACTIVATE SSL
SSLEngine On
# CONFIG FOR LETSENCRYPT
SSLProtocol -ALL -SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2
SSLHonorCipherOrder On
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Alias /awstats-icon "/usr/share/awstats/icon"
RewriteEngine On
# www to non www for HTTPS
# checking for the same thing again
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
# some people might argue second redirect here is excessive since you already arrived at correct host, but I'd leave this for you to sort out
RewriteRule ^/(.*) https://example.com/$1 [R=301,L]
# your /cgi-bin checks can be merged into one regex
# See also : https://stackoverflow.com/questions/60732096/awstats-tool-issue-with-missing-icons-and-histogram-bars-on-main-page-of-awsta/61178404#61178404
RewriteCond %{REQUEST_URI} !^/awstats [NC]
RewriteCond %{REQUEST_URI} !^/cgi-bin/(search|awstats) [NC]
RewriteRule ^/(.*) https://localhost:8443/++vh++https:%{SERVER_NAME}:443/++/$1 [P,L]
SSLProxyEngine On
RequestHeader set Front-End-Https "On"
#CacheDisable *
<Files "awstats.pl">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
SetHandler cgi-script
Satisfy any
Order deny,allow
Deny from all
AuthType Basic
AuthName "Advanced Web Statistics"
AuthUserFile /etc/apache2/awstats-users.pwd
Require valid-user
</Files>
<Directory "/usr/share/awstats/icon">
AllowOverride None
/Files>
<Directory "/usr/share/awstats/icon">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/usr/lib/cgi-bin/">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
SSLRequireSSL
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin henry@example.com
ServerName example.com
ServerAlias www.example.com
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to ww.xx.yy.zz
RewriteCond %{HTTP_HOST} ^ww\.xx\.yy\.zz
RewriteRule (.*) http://example2.com$1 [R=301,L]
# www to non www for HTTP and HTTPS
RewriteCond %{REQUEST_URI} ^/www\. [NC,OR]
RewriteCond %{REQUEST_URI} !^/cars/video [NC]
# Rewrite below works : redirect 80 => https
RewriteRule ^/(.*) https://example.com/$1 [R=301,L]
# www to non www for HTTP
# if you want to keep your `/cars/video` on http check it first
#RewriteCond %{REQUEST_URI} !^/cars/video [NC]
RewriteRule ^/(.*) http://localhost:9674/++vh++http:%{SERVER_NAME}:80/++/$1 [P,L]
</IfModule>
</VirtualHost>
Unfortunately, the number of daily visits is almost null:
whereas before the upgrade to Debian 10, I had a mean of 200 unique visits a day.
I have included this configuration file above "vhost.conf
" into "/etc/apache2/httpd.conf
" file like this:
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
CustomLog /var/log/apache2/access.log combined
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
#LoadModule proxy_ftp_module /usr/lib/apache2/modules/mod_proxy_ftp.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_connect_module /usr/lib/apache2/modules/mod_proxy_connect.so
#LoadModule authn_alias_module /usr/lib/apache2/modules/mod_authn_alias.so
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
LoadModule cgid_module /usr/lib/apache2/modules/mod_cgid.so
#LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule mime_magic_module /usr/lib/apache2/modules/mod_mime_magic.so
LoadModule cache_module /usr/lib/apache2/modules/mod_cache.so
#LoadModule disk_cache_module /usr/lib/apache2/modules/mod_disk_cache.so
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
# Get back visitors for awstats
#LoadModule remoteip_module /usr/lib/apache2/modules/mod_remoteip.so
#LogLevel debug
LogLevel alert rewrite:trace3
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %v" full
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %P %T" debug
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
NameVirtualHost *:80
include vhost.conf
What might be wrong here?
By the way, the log file access.log
seems to be correctly filled when there are visitors: I don't understand what's happened.
Here I provide a link of my current setup of awstats.conf
:
All the Apache configuration related information you posted appears to be sound except for an entry that allows the AWStats CGI(Perl) script to be accessed/executed. The fact that you indicated the Apache access.log is being populated makes me think this is an issue with how AWStats is configured. On Debian, you'll want to look in the folder:
/etc/awstats
and find a .conf file that matches your Apache vhost configuration. Be sure that the .conf file is properly referencing your Apache access.log file as the source for producing the statistics.
Some other considerations include checking that AWStats is configured to parse your log files on a regular basis via CRON routines or maybe even on demand based on the AWStats' configuration file mentioned above. If it's not configured to run on demand then a CRON job will need to be implemented to parse the logs on a regular basis.
Don't assume your prior AWStats configuration is still relevant after an upgrade. If not configured correctly your upgrade to Debian may have wiped out your previous settings.
Follow-up
Based on the awstats.conf file you posted be sure and define the host aliases attribute with all the virtual host extensions you expect:
HostAliases="localhost 127.0.0.1 REGEX [.com|net|org$]"
The DNS lookup should NOT be required. Set this to:
DNSLookup=2
Then in your Apache conf files you will want to be sure that you are allowing the AWStats Perl script to be executed in the directory that you wish to access these statistics. Something along these lines in each virtual domain conf you want AWStats to be accessible:
# Virtual host container
ScriptAlias /cgi-bin/ /path/to/cgi-bin/
<Directory "/path/to/htdocs/virtual-domain/cgi-bin">
AllowOverride None
Options +ExecCGI +SymLinksIfOwnerMatch
Require all granted
</Directory>