设为首页 收藏本站
查看: 1318|回复: 0

[经验分享] http配置安装和部署Awstats统计Http访问日志

[复制链接]

尚未签到

发表于 2019-1-30 08:29:18 | 显示全部楼层 |阅读模式
  实验一:基本HTTP服务器的配置
      主机名设为:www.tarena.com  192.168.10.10
      默认首页包括:index.html、index.php
      开启保持连接
      确认默认httpd是否支持php
  前提条件在客户端配置hosts文件
  192.168.10.10www.tarena.comwww
  图(1)
  1、软件包的安装
  [root@localhost ~]# rpm -q httpd
  httpd-2.2.3-74.el5
  //如果没有安装
  [root@localhost ~]# yum -y install httpd
  2、修改主配置文件
  

  [root@localhost ~]# vim /etc/httpd/conf/httpd.conf
  ...
  74 KeepAlive On    //开启保持连接
  ...
  265 ServerName www.tarena.com:80   //主机名设为:www.tarena.com
  ...
  391 DirectoryIndex index.html index.php  // index.html、index.php
  ...
  3、启动服务
  [root@localhost ~]# service httpd restart
  [root@localhost ~]# chkconfig httpd on
  新建测试页面
  [root@localhost ~]# cat /var/www/html/index.html
  www "welcome to the"com        //随意写入
  [root@localhost ~]# cat /var/www/html/index.php
  
  Win7测试:
  http://www.tarena.com
  

  图(2)
  http://www.tarena.com/index.php
  图(2)
  

  图(3)
  在linux上测试
  

  图(4)
  

  图(5)
  

  

  

  

  

  

  

  

  

  

  

  

  

  实验二:HTTP的访问控制
  只允许192.168.1.2也就是win7系统客户端访问www.tarena.com
  允许所有用户访问www.tarena.com/authdir/index.html
  前提条件在客户端配置hosts文件
  192.168.10.10www.tarena.comwww
  1、软件包的安装
  [root@localhost ~]# rpm -q httpd
  httpd-2.2.3-74.el5
  //如果没有安装
  [root@localhost ~]# yum -y install httpd
  2、修改主配置文件
  [root@localhost ~]# mkdir /var/www/html/authdir  //创建文件夹
  [root@localhost ~]# vim /var/www/html/authdir/index.html
  
  This is a test Page!!!
  
  This is http://www.tarena.com/authdir/index.html!!!
  
  
  
  [root@localhost ~]# vim /etc/httpd/conf/httpd.conf
  ...
  306
  ...
  332     Order allow,deny
  333 #    Allow from all
  334     Allow from 192.168.10.5
  ...
  337
  338         Order allow,deny
  339         Allow from all
  340
  3、启动服务
  [root@localhost ~]# service httpd restart
  4、在不同客户端测试
  Win7上测试
  

  图(6)
  

  图(7)
  在linux上测试
  

  图(8)
  Linux没有权限
  

  图(9)
  访问www.tarena.com/authdir/index.html成功
  

  

  

  试验三:HTTP的用户授权
  客户端访问/var/www/html/authdir/需要输入用户名密码验证
  1、软件包的安装
  [root@localhost ~]# rpm -q httpd
  httpd-2.2.3-74.el5
  //如果没有安装
  [root@localhost ~]# yum -y install httpd
  2、修改主配置文件
  [root@localhost ~]# vim /etc/httpd/conf/httpd.conf
  ...
  337
  338         Order allow,deny
  339         Allow from all
  340         AuthName "Please Input Password!!"
  341         AuthType Basic
  342         AuthUserFile "/etc/httpd/.vuser"
  343         Require valid-user
  344
  ...
  2、创建账户密码
  [root@localhost ~]# htpasswd -c /etc/httpd/.vuser admin
  New password:
  Re-type new password:
  Adding password for user admin
  3、启动服务测试
  [root@localhost ~]# service httpd restart
  4、在客户机上测试
  Win7
  http://www.tarena.com/authdir
  

  图(10)
  

  图(11)
  实验四:HTTP目录别名
  要求:
  客户端访问http://www.tarena.com/sina时可以访问/var/www/html/sina.com/bbs下的网页
  1、创建测试站点
  [root@localhost ~]# mkdir -p /var/www/html/sina.com/bbs
  [root@localhost ~]# cat /var/www/html/sina.com/bbs/index.html
  
  This is a test Page!!!
  
  This is bbs.sina.com test Page!!!
  
  
  
  2、修改主配置文件
  [root@localhost ~]# tail -n 1 /etc/httpd/conf/httpd.conf
  Alias /sina     "/var/www/html/sina.com/bbs"
  3、启动服务测试
  [root@ser1 ~]# service httpd restart
  http://www.tarena.com/sina
  4、在客户端测试
  在win7上
  

  图(12)
  实验五:
  部署Awstats统计Http访问日志
  1、安装软件(软件在/usr/src下)
  [root@ser1 ~]# cd /usr/src/
  [root@ser1 src]# tar -zxf awstats-7.1.tar.gz
  [root@ser1 src]# mv awstats-7.1 /usr/local/awstats
  2、为站点建立配置文件
  [root@ser1 src]# cd /usr/local/awstats/tools/
  [root@ser1 tools]# ./awstats_configure.pl
  ...
  Config file path ('none' to skip web server setup):
  > /etc/httpd/conf/httpd.conf    //输入apache的主配置文件
  ...
  -----> Need to create a new config file ?
  Do you want me to build a new AWStats config/profile
  file (required if first install) [y/N] ? y
  ...
  Your web site, virtual server or profile name:
  > www.tarena.com            //输入你的web服务器名字
  ...
  Default: /etc/awstats
  Directory path to store config file(s) (Enter for default):
  >
  ...
  /usr/local/awstats/tools/awstats_updateall.pl now
  Press ENTER to continue...
  ...
  Press ENTER to finish...
  3、指定统计的目标日志文件
  [root@ser1 tools]# vim /etc/awstats/awstats.www.tarena.com.conf
  ...
  51 LogFile="/var/log/httpd/access_log"
  [root@ser1 tools]# mkdir /var/lib/awstats
  4、将日志文件导入Awstats
  [root@ser1 tools]# ./awstats_updateall.pl now
  [root@ser1 tools]# crontab -e
  */5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
  [root@ser1 tools]# service crond restart
  [root@ser1 tools]# chkconfig crond on
  5、验证
  验证:
  http://www.tarena.com/awstats/awstats.pl?config=www.tarena.com
  

  图(13)
  验证:
  http://www.tarena.com/awstats.html
  

  图(14)
  建立跳转页
  [root@ser1 tools]# vim /var/www/html/awstats.html
  
  
  
  
  
  
  

  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-669393-1-1.html 上篇帖子: Nginx 日志分析 AWStats + JAWStats 安装配置 下篇帖子: awstats分析nginx日志访问404问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表