AWSTATS是一个免费的工具,为Web,FTP或者邮件服务器生成高级图形,具有Apache2,IIS和其他服务器的日志文件分析。
Awstats使用日志文件分析来分析来自Apache2,IIS和其他流行Web服务器的日志文件。
当我们必须分析流量和其他数据时,它是一个非常方便的工具。
第3步:配置awstats
打开默认配置文件。
sudo nano /etc/awstats/awstats.conf
添加服务器名称并保存文件。
# Examples for Apache combined logs (following two examples are equivalent): # LogFormat = 1 # LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererqu$ # Example for IIS: # LogFormat = 2 # LogFormat=1 # But for multi hosting a better solution is to have one log file for each # virtual web server. In this case, this parameter is only used to generate # full URL's links when ShowLinkmongorl option is set to 1. # If analyzing mail log, enter here the domain name of mail server. # SiteDomain="example.com"
运行下面命令以创建AWSTATS Web配置文件。
sudo cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf-available/awstats.conf
打开刚刚创建的配置文件
sudo nano /etc/apache2/conf-available/awstats.conf
参考下面的更改并保存文件。
# This provides worldwide access to everything below the directory # Security concerns: # * Raw log processing data is accessible too for everyone # * The directory is by default writable by the httpd daemon, so if # any PHP, CGI or other script can be tricked into copying or # symlinking stuff here, you have a looking glass into your server, # and if stuff can be uploaded to here, you have a public warez site! <Directory /var/lib/awstats> Options None AllowOverride None Order allow,deny Allow from all </Directory> # This provides worldwide access to everything below the directory # Security concerns: none known <Directory /usr/share/awstats/icon> Options None AllowOverride None Order allow,deny Allow from all </Directory> # This provides worldwide access to everything below the directory # Security concerns: none known <Directory /usr/share/java/awstats> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> # This provides worldwide access to everything in the directory # Security concerns: none known Alias /awstats-icon//usr/share/awstats/icon/ # This provides worldwide access to everything in the directory # Security concerns: none known Alias /awstatsclasses//usr/share/java/awstats # This provides worldwide access to everything in the directory # Security concerns: none known Alias /awstatsclasses//usr/share/java/awstats # This (hopefully) enables _all_ CGI scripts in the default directory # Security concerns: Are you sure _all_ CGI scripts are safe? ScriptAlias /cgi-bin//usr/lib/cgi-bin/ Alias /awstatsclasses "/usr/share/awstats/lib/" Alias /awstats-icon/"/usr/share/awstats/icon/" Alias /awstatscss "/usr/share/doc/awstats/examples/css" ScriptAlias /cgi-bin//usr/lib/cgi-bin/ ScriptAlias /awstats//usr/lib/cgi-bin/ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
运行以下命令以启用AWSTATS模块。
sudo a2enconf awstats serve-cgi-bin sudo a2enmod cgi
重新启动Apache2以进行应用更改。
sudo systemctl restart apache2
调整awstats权限和更新。
sudo sed -i -e "s/www-data/root/g" /etc/cron.d/awstats sudo /usr/share/awstats/tools/update.sh
最后,浏览器打开:
http://example.com/cgi-bin/awstats.pl
你应该看到awstats页面。
第1步:安装apache2
在Ubuntu上 运行以下命令 安装Apache2。
sudo apt update sudo apt install apache2
第2步:安装awstats
在Ubuntu存储库中获取当前稳定的awstats版本并安装。
sudo apt install awstats
日期:2020-07-07 20:57:23 来源:oir作者:oir