1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # /opt/nginx/sbin/logcron.sh # /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.moabc.net Create/Update database for config "/etc/awstats/awstats.www.moabc.net.conf" by AWStats version 6.7 (build 1.892) From data in log file "/opt/nginx/logs/access_20080804.log"... Phase 1 : First bypass old records, searching new record... Direct access after last parsed record (after line 450421) Jumped lines in file: 450421 Found 450421 already parsed records. Parsed lines in file: 120 Found 0 dropped records, Found 0 corrupted records, Found 0 old records, Found 120 new qualified records. |
1 2 3 4 5 | # mkdir /data/webroot/awstats # /usr/local/awstats/tools/awstats_buildstaticpages.pl -update \ -config=www.moabc.net -lang=cn -dir=/data/admin_web/awstats \ -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | server { listen 80; server_name localhost; location ~ ^/web/ { root /data/web; index index.html; error_log off; charset gb2312; } location ~ ^/awstats/ { # html 静态页面目录 root /data/webroot/awstats; index index.html; access_log off; error_log off; charset gb2312; #最好把默认编码改成 gb2312避免浏览器因自动编码出现乱码的情况 } location ~ ^/icon/ { # 图标目录 root /usr/local/awstats/wwwroot; index index.html; access_log off; error_log off; charset gb2312; } } |
1 2 3 4 5 6 7 8 9 10 11 12 | #vi /etc/crontab 11 59 * * * /opt/nginx/sbin/logcron.sh #半夜11:59 进行日志切割 00 1 * * * /usr/local/awstats/tools/awstats_buildstaticpages.pl \ -update -config=www.moabc.net -lang=cn -dir=/data/admin_web/awstats \ -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl #凌晨00:01 Awstats进行日志分析 :wq保存退出 #crontab /etc/crontab 指定cron所执行的配置档路径 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #/usr/local/apache2/bin/htpasswd -c admin.pass admin #用户名为admin New password: 输入密码 Re-type new password: 重复输入 Adding password for user admin 创建成功 然后把 admin.pass 这个密码包找个的地方藏起来. 修改 nginx.conf 在 location 中加入(加粗部分): server { listen 80; server_name localhost; location ~ ^/web/ { root /data/web; index index.html; error_log off; charset gb2312; } location ~ ^/awstats/ { # html 静态页面目录 root /data/admin_web; index index.html; access_log off; error_log off; charset gb2312; auth_basic "admin"; #用户名 /opt/ngx/conf/admin.pass; #密码包路径 } location ~ ^/icon/ { # 图标目录 root /usr/local/awstats/wwwroot; index index.html; access_log off; error_log off; charset gb2312; } } 修改 Nginx 配置完毕后,执行命令 killall –s HUP nginx 让 Nginx 重新加载配置即可。 |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |