-----------------------------------------------------------------
awstatsインストール epel からインストール [root@falcon21 ~]# yum --enablerepo=epel -y install awstats インストール: awstats.noarch 0:7.7-1.el7 依存性関連をインストールしました: perl-Business-ISBN.noarch 0:2.06-2.el7 perl-Business-ISBN-Data.noarch 0:20120719.001-2.el7 perl-CGI.noarch 0:3.63-4.el7 perl-Digest.noarch 0:1.17-245.el7 perl-Digest-HMAC.noarch 0:1.03-5.el7 perl-Digest-MD5.x86_64 0:2.52-3.el7 perl-Digest-SHA.x86_64 1:5.85-4.el7 perl-Encode-Locale.noarch 0:1.03-5.el7 perl-FCGI.x86_64 1:0.74-8.el7 perl-File-Listing.noarch 0:6.04-7.el7 perl-Geo-IP.x86_64 0:1.43-3.el7 perl-HTML-Parser.x86_64 0:3.71-4.el7 perl-HTML-Tagset.noarch 0:3.20-15.el7 perl-HTTP-Cookies.noarch 0:6.01-5.el7 perl-HTTP-Daemon.noarch 0:6.01-8.el7 perl-HTTP-Date.noarch 0:6.02-8.el7 perl-HTTP-Message.noarch 0:6.06-6.el7 perl-HTTP-Negotiate.noarch 0:6.01-5.el7 perl-IO-HTML.noarch 0:1.00-2.el7 perl-IO-Socket-IP.noarch 0:0.21-5.el7 perl-IO-Socket-SSL.noarch 0:1.94-7.el7 perl-LWP-MediaTypes.noarch 0:6.02-2.el7 perl-Mozilla-CA.noarch 0:20130114-5.el7 perl-Net-DNS.x86_64 0:0.72-6.el7 perl-Net-HTTP.noarch 0:6.06-2.el7 perl-Net-IP.noarch 0:1.26-4.el7 perl-Net-LibIDN.x86_64 0:0.12-15.el7 perl-Net-SSLeay.x86_64 0:1.55-6.el7 perl-Switch.noarch 0:2.16-7.el7 perl-TimeDate.noarch 1:2.30-2.el7 perl-URI.noarch 0:1.60-9.el7 perl-WWW-RobotRules.noarch 0:6.02-5.el7 perl-libwww-perl.noarch 0:6.05-2.el7 完了しました! ------------------------------------- 自動作成された awstats.falcon21.space.conf を確認 [root@falcon21 ~]# vi /etc/awstats/awstats.falcon21.space.conf falcon21.spaceが自動で設定 171 #HostAliases="REGEX[^.*falcon21\.space$]" 172 HostAliases="localhost 127.0.0.1 REGEX[falcon21\.space$] REGEX[^192\.168\.2\.]" ------------------- httpd での表示設定を確認 [root@falcon21 ~]# vi /etc/httpd/conf.d/awstats.conf 1 # 2 # Content of this file, with correct values, can be automatically added to 3 # your Apache server by using the AWStats configure.pl tool. 4 # 5 6 7 # If using Windows and Perl ActiveStat, this is to enable Perl script as CGI. 8 #ScriptInterpreterSource registry 9 10 11 # 12 # Directives to add to your Apache conf file to allow use of AWStats as a CGI. 13 # Note that path "/usr/share/awstats/" must reflect your AWStats install path. 14 # 15 Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/" 16 Alias /awstatscss "/usr/share/awstats/wwwroot/css/" 17 Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/" 18 ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/" 19 20 21 # 22 # This is to permit URL access to scripts/files in AWStats directory. 23 # 24 <Directory "/usr/share/awstats/wwwroot"> 25 Options None 26 AllowOverride None 27 <IfModule mod_authz_core.c> 28 # Apache 2.4 29 Require local 30 Require ip 192.168.2.0/24 # アクセス許可IP追記 31 </IfModule> 32 <IfModule !mod_authz_core.c> 33 # Apache 2.2 34 Order allow,deny 35 Allow from 127.0.0.1 36 Allow from ::1 37 </IfModule> 38 </Directory> 39 # Additional Perl modules 40 <IfModule mod_env.c> 41 SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins 42 </IfModule> 43 ~ ------------------------------------------AWStatsデータベース初期化作成[root@falcon21 ~]# vi awstatsinit.sh#!/bin/shlogfile=`grep ^LogFile /etc/awstats/awstats.$1.conf|sed -e 's/LogFile="\([^ ]*\)"/\1/p' -e d`for log in `ls $logfile*|sort -r`do`rpm -ql awstats|grep "awstats\.pl"` \-config=$1 -update -logfile=$logdone# 現在ログ処理for Apachelog in `ls $logfile|sort`do`rpm -ql awstats|grep "awstats\.pl"` \-config=$1 -update -logfile=$logdoneApache設定[root@falcon21 ~]# sh awstatsinit.sh falcon21.spaceCreate/Update database for config "/etc/awstats/awstats.falcon21.space.conf" by AWStats version 7.7 (build 20180105)From data in log file "/var/log/httpd/access_log"...Phase 1 : First bypass old records, searching new record...Direct access after last parsed record (after line 469)Jumped lines in file: 469Found 469 already parsed records.Parsed lines in file: 5Found 0 dropped records,Found 0 comments,Found 0 blank records,Found 0 corrupted records,Found 0 old records,Found 5 new qualified records.
設定を反映 [root@falcon21 ~]# systemctl restart httpd --------------------- 1時間毎に自動更新 [root@falcon21 ~]# /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=falcon21.space -update Create/Update database for config "/etc/awstats/awstats.falcon21.space.conf" by AWStats version 7.7 (build 20180105) From data in log file "/var/log/httpd/access_log"... Phase 1 : First bypass old records, searching new record... Direct access after last parsed record (after line 1657) Jumped lines in file: 1657 Found 1657 already parsed records. Parsed lines in file: 0 Found 0 dropped records, Found 0 comments, Found 0 blank records, Found 0 corrupted records, Found 0 old records, Found 0 new qualified records. -------------------- 「http://(サーバーのホスト名またはIPアドレス/)/awstats/awstats.pl」にアクセスする http://192.168.2.101/awstats/awstats.pl Error: Couldn't open config file "awstats.192.168.2.101.conf" nor "awstats.conf". Please read the documentation for directories where the configuration file should be located.ApApache設定acheログローテーション追加設定[root@falcon21 ~]# vi /etc/logrotate.d/httpd1 /var/log/httpd/*log {2 missingok3 notifempty4 sharedscripts5 delaycompress6 postrotate7 `rpm -ql awstats|grep "awstats_updateall\.pl"` now -confdir="/etc/awstats" \8 -awstatsprog="`rpm -ql awstats|grep "awstats\.pl"`" >/dev/null9 /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true10 endscript11 }
- Did you use the correct URL ?
Example: http://localhost/awstats/awstats.pl?config=mysite
Example: http://127.0.0.1/cgi-bin/awstats.pl?config=mysite
- Did you create your config file 'awstats.192.168.2.101.conf' ?
If not, you can run "awstats_configure.pl" from command line, or create it manually.
Check config file, permissions and AWStats documentation (in 'docs' directory). ssl 設定無しでは、表示できない。 IPアドレスで、表示できるように、awstats.falcon21.space.confをコピー 、awstats.192.168.2.101.confとして保存 http://192.168.2.101/awstats/awstats.pl にアクセス OK.
投票数:18
平均点:10.00