软件包
 httpd-2.2.17.tar.gz  

(1)安装

./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
 --prefix:指定将httpd服务程序安装到那个目录
 --enable-so:启动动态加载模块支持,使httpd具备进一步扩展功能的能力。
 --enable-rewrite:启用网页地址重写功能,用于网站优化及目录迁移维护。
 --enable-charset-lite:启动字符集支持,以便支持使用各种字符集编码的网页。
 --enable-cgi:启用CGI脚本程序支持,便于扩展网站的应用访问能力。
 make
 make install
 ls /usr/local/httpd      确认安装结果
 ln -s /usr/local/httpd/bin/* /usr/local/bin     优化执行路径
 httpd -v                                        查看程序版本
 Server version: Apache/2.2.17 (Unix)
 Server built:   May 25 2013 18:38:47(2)建立服务脚本
 cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd  
 vi /etc/init.d/httpd 
 # chkconfig: 35 85 15       服务识别参数,级别3、5中启动;启动的顺序分别为85、15
 # description: Startup script for the Apache HTTP Server      服务描述信息chkconfig --add httpd   将httpd添加为系统服务
  chkconfig --list httpd    查看httpd的自启动状态(3)基本配置
 vi /usr/local/httpd/conf/httpd.conf
 ServerName www.benet.com     添加主机名
  /usr/local/httpd/bin/apachectl -t      对配置文件进行语法检查
 Syntax OK
 /etc/init.d/httpd start
  netstat -anpt |grep httpd
 tcp        0      0 :::80                       :::*                        LISTEN      3310/httpd          
 cat /usr/local/httpd/htdocs/index.html        部署网页文档
 <html><body><h1>It works!</h1></body></html>tail /usr/local/httpd/logs/access_log    查看访问日志文件
 tail /usr/local/httpd/logs/error_log     查看错误日志文件(4)主配置文件
 ①全局配置项
 ServerRoot "/usr/local/httpd"    设置httpd服务器的根目录,该目录中包括了运行web站点必需的子目录和文件,默认的根目录为/usr/local/httpd,与httpd的安装目录相同,在httpd.conf配置文件中,如果指定目录或文件位置是不使用绝对路径,则该目录或文件位置都认为是在服务器的根目录下面。
 Listen 80     设置httpd服务器监听的网络端口号
 <IfModule !mpm_netware_module>
 <IfModule !mpm_winnt_module>
 User daemon   设置运行httpd进程时的用户身份
 Group daemon  设置运行httpd进程时的组身份
 </IfModule>
 </IfModule>
 ServerAdmin you@example.com    设置httpd服务器的管理员email地址,可以通过此email地址及时联系web站点的管理员。
 ServerName www.benet.com      设置web站点的完整主机名(主机名+域名)
 DocumentRoot "/usr/local/httpd/htdocs"     设置网站根目录,即网页文档在系统中的实际存放路径。
 <Directory />
     Options FollowSymLinks
     AllowOverride None
     Order deny,allow
     Deny from all
 </Directory>
 <Directory "/usr/local/httpd/htdocs">
 Options Indexes FollowSymLinks 
 </Directory>
 <IfModule dir_module>
     DirectoryIndex index.html        设置网站的默认索引页(首页),可以设置多个首页文件,以空格分开
 </IfModule>
 <FilesMatch "^\.ht">
     Order allow,deny
     Deny from all
     Satisfy All
 </FilesMatch>
 ErrorLog "logs/error_log"            设置错误日志文件的路径
 LogLevel warn                        设置记录日志的级别,默认级别为warn(警告)
 <IfModule log_config_module>
    
     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
     LogFormat "%h %l %u %t \"%r\" %>s %b" common
     <IfModule logio_module>
     
       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
     </IfModule>
  
    
     CustomLog "logs/access_log" common    设置访问日志文件的路径、日志类型,默认为common通用格式
    
 </IfModule>
 <IfModule alias_module>
   
     ScriptAlias /cgi-bin/ "/usr/local/httpd/cgi-bin/"
 </IfModule>
 <IfModule cgid_module>
   
 </IfModule>
 <Directory "/usr/local/httpd/cgi-bin">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
 </Directory>
 DefaultType text/plain
 <IfModule mime_module>
   
 </IfModule>
 <IfModule ssl_module>
 SSLRandomSeed startup builtin
 SSLRandomSeed connect builtin
 </IfModule>
 Include conf/extra/httpd-vhosts.conf    包含另一个配置文件的内容
 pidfile logs、httpd.pid    设置用于保存httpd进程号的文件,
 charsetdefault  UTF-8 设置站点中的网页默认使用的字符集编码
 ②区域配置项
 <Directory />       定义“/”目录区域的开始
     Options FollowSymLinks     控制选项,允许使用符号链接
     AllowOverride None         不允许隐含控制文件中的额覆盖配置
     Order deny,allow           访问控制策略的应用顺序
     Deny from all              禁止任何人访问此区域
 </Directory>                   定义“/”目录区域的结束(5)网站访问情况统计
 软件包 awstats-7.0.zip 
  unzip awstats-7.0.zip          (1)安装awstats软件包
 mv awstats-7.0 /usr/local/awstats
  cd /usr/local/awstats/tools/            (2)为要统计的站点建立配置文件
 ./awstats_configure.pl                   
 输入/usr/local/httpd/conf/httpd.conf 输入httpd.conf配置文件的路径
 Do you want me to setup Apache to write 'combined' log files [y/N] ? y是否将httpd服务器的日志记录格式改为combined,服务器可以在日志文件中记录更加乡里的web访问信息
 file (required if first install) [y/N] ? y
 输入要统计的目标网站名称 www.benet.com
 直接按enter接受默认设置vim /etc/awstats/awstats.www.benet.com.conf   (3)修改站点统计配置文件
LogFile="/usr/local/httpd/logs/www/benet.com.access_log"    要分析的web日志文件
 DirData="/var/lib/awstats"                  指定用来存放统计数据的目录/usr/local/awstats/tools/awstats_updateall.pl now    (4)执行日志分析,并设置cron计划任务
crontab -e           设置计划任务,每5分钟执行一次日志分析任务
 */5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now   (这条命令有问题吗)
  /etc/init.d/crond restart
  chkconfig --level 35 crond on
 访问http://www.benet.com/awstats/awstats.pl?config=www.benet.com,即可以看到awstats日志分析系统的统计页面