I configured it based on two URLs:
http://www.centospub.com/make/awstats.html
http://www.centos.bz/2012/02/analyze-nginx-log-with-awstats/
I chose version awstats-7.2.tar.gz, which is the latest version. You need a VPN to download it.
I set this up on Alibaba Cloud CentOS 6.2 64-bit.
After the configuration was complete, I opened the URL http://*.*.*.*/awstats/awstats.pl?config=www.***.com,

Searching online, some said to set the permissions of /usr/local/awstats/ to 755 or even 777. I did that, but it still wouldn’t open. Later, I found a post suggesting the following:
<Directory “/usr/local/awstats/wwwroot”>
Options Includes ExecCGI FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted (mainly added this line)
</Directory>
The 403 error finally disappeared, but when I opened the URL, it displayed the source code. I had to keep analyzing the issue:

There is a line in httpd.conf:
#LoadModule cgid_module modules/mod_cgid.so, which I changed to
LoadModule cgid_module modules/mod_cgid.so, but this caused Apache to fail to start. I finally checked the modules directory and found the reason was that mod_cgid.so did not exist. However, I noticed another file, mod_cgi.so, so I gave it a try by adding the line:
LoadModule cgi_module modules/mod_cgi.so. It finally opened, but the page was blank and prompted that it had not been updated. I was a bit frustrated.
I continued analyzing the issue. Finally, I cleared the contents of several log files, such as logs/access_log, because when executing
/root/awstats.sh, it reported an access_log format error and seemingly a permission warning as well.
Some time after clearing them, once the access_log and other log files had content again, I reran the command. Finally, http://*.*.*.*/awstats/awstats.pl?config=www.***.com displayed content. Well, the basic configuration is done, but I still need to set up username and password access to make it feel more secure.
Configuration in httpd.conf:
#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”
Alias /awstatscss “/usr/local/awstats/wwwroot/css/”
Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”
ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory “/usr/local/awstats/wwwroot”>
Options Includes ExecCGI FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
AuthType Basic
AuthName “awstats access”
AuthUserFile /usr/local/awstats/htpasswd
Require valid-user
</Directory>
/usr/local/apache/bin/htpasswd -c /usr/local/awstats/htpasswd username (set this to your username for accessing awstats), then enter the password twice, and now it works. It took a day and a half, but the configuration is finally complete. Hehe!

