**********************************************************************************************888
    Apache服务器的安装及其应用
    准备环境
 
    1. 搭建DNS服务器
 
    2. 开始FTP服务
    3. 上传APache源码包
    4. 进行编译安装
    5. 测试
 ————————————————————————————————————————————————  
    应用
 
    1. 创建用户,并设密码
    2. 设置用户的个人主页目录
    3. 在主页目录中创建名为index.html的文件
    4. 配置域名虚拟主机
    5. 测试
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   1.搭建DNS服务器
     (1)域名服务器的两个软件包分别在第四和第一张光盘上,bind和caching,必须先安装bind软件包。
                        mount /media/cdrom
                        cd /media/cdrom/RedHat/RPMS
                        rpm -ivh bind-9.2.4-2
                        eject
                        mount /media/cdrom
                        cd /media/cdrom/RedHat/RPMS
                        rpm -ivh caching-nameserver-7.3.3.noarch.rpm
 
    (2)开启区域
                   
                      vi /etc/named.conf
                      include "/etc/rndc.key";
                      zone "hongwei.com"{
                             type master;
                             file "hongwei.com";
                      };
   (3)做区域配置文件
             
                    cd /var/named
                    cp named.local hongwei.com
                    vi hongwei.com
                                 
                    $TTL    86400
                    @       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
                    @              IN      NS      localhost.
                    www            IN       A      172.16.2.99
     (4)修改linux主机的DNS
                     
                    vi /etc/resolv.conf
                    namedomain=172.16.2.99
     (5)测试
                  nslookup
                 
                  > www.hongwei.com
                  Server:         172.16.2.99
                  Address:        172.16.2.99#53
                  Name:   www.hongwei.com
                  Address: 172.16.2.99
——————————————————————————————————————————————
                 
     2. 开启FTP 服务
                    service  vsftpd start
——————————————————————————————————————————————
     3.进行编译安装
     (1)上传上传APache源码包
                  [root@rhel4 ~]# cd /home/aa
                  [root@rhel4 aa]# ls
                  httpd-2.0.59.tar.gz
     (2)释放源码包文件
          
                  tar zxvf httpd-2.0.59.tar.gz
     
     (3)编译前的配置
                  ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
     (4) 编译服务器的程序
                    make
     (5)安装已编译完成的程序
                    make install
     (6)重启服务
                    /etc/rc.d/init.d/httpd start
     (7)测试
                 
                    http:/www.hongwei.com
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

      应用

    1. 创建用户,并设密码
                  # useradd lei
                  # passwd lei
                  # Changing password for user lei.
                  New UNIX password:    设置密码
                  Retype new UNIX password:     确认密码
                  passwd: all authentication tokens updated successfully.
    
——————————————————————————————————————————————————--
      2. 设置用户的个人主页目录
 
                  [root@rhel4 ~]# cd /home/lei
                  [root@rhel4 lei]# mkdir public_html
                 
———————————————————————————————————————————————————
    3. 在主页目录中创建名为index.html的文件
                 [root@rhel4 lei]# cd public_html
                 [root@rhel4 public_html]# vi index.html
———————————————————————————————————————————————————
    4.设置权限
                 chmod o+x /home/lei
                 service httpd stop
                 Stopping httpd:                                            [  OK  ]
———————————————————————————————————————————————————
    5.重启服务
                 /usr/local/apache2/bin/apachectl start
———————————————————————————————————————————————————
    4. 配置域名虚拟主机
                   vi /usr/local/apache2/conf/httpd.conf
 
                   #</VirtualHost
                   NameVirtualHost 172.16.2.99
                   <VirtualHost 172.16.2.99>
                       ServerName www.hongwei.com
                       DocumentRoot /home/lei/public_html
                   </VirtualHost>
————————————————————————————————————————————————-——
     5.重启服务
                  /usr/local/apache2/bin/apachectl restart
———————————————————————————————————————————————————
     6.测试
                    http://www.hongwei.com/