一,基本配置<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 
1,检查软件包是否完全安装(系统默认安装)
httpd-manual-2.2.3-11.el5
httpd-2.2.3-11.el5
2,mkdir /var/www/html/www.test.com
     vi /var/www/html/www.test.com/index.html
  mkdir /ver/www/html/polo.test.com
     vi /var/www/html/polo.test.com/index.html

vi/etc/httpd/conf/httpd.conf

ServerAdmin [email]root@test.com[/email]

DirectoryIndex index.html index.html.var

DocumentRoot "var/www/html"

 

<VirtualHost *:80>

    ServerAdmin [email]root@test.com[/email]

    DocumentRoot /var/www/html/www.test.com

    ServerName [url]www.test.com[/url]

   <Directory "/var/www/html/www.test.com">

       AllowOverride None

       Options Indexes                                                                               

       Order allow,deny

       Allow from all

   </Directory>

   ErrorLog logs/www.test.com-error_log

CustomLog logs/www.test.com-access_log common

</VirtualHost>

 

<VirtualHost polo.test.com:80>

    ServerAdmin [email]root@test.com[/email]

    DocumentRoot /var/www/html/polo.test.com

    ServerName polo.test.com

   <Directory "/var/www/html/polo.test.com">

       AllowOverride None

       Options Indexes                                                                               

       Order allow,deny

       Allow from all

   </Directory>

ErrorLog logs/polo.test.com-error_log

CustomLog logs/polo.test.com-access_log common

</VirtualHost>

3,chkconfig –level 35 httpd on
4,service httpd start 或者 service httpd restart
5,进行IE测试

 

二,用户访问控制

 

 

 

示例:

htpasswd -cm /var/www/.htpasswd polo

  chown apache.apache .htpasswd

<VirtualHost polo.test.com:80>

    ServerAdmin [email]root@test.com[/email]

    DocumentRoot /var/www/html/polo.test.com

    ServerName polo.test.com

   <Directory "/var/www/html/polo.test.com/test">

        Order Deny,Allow

        Deny from all

       Allow from <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.6.0.0/255.255.255.0

       AuthType Basic

       AuthName "polo"

       AuthUserFile /etc/httpd/.htpasswd

       require user polo

    </Directory>

</VirtualHost>
 
保存退出
启动:service httpd start 或者 service httpd restart

进行IE测试