2014-04-11 11:13:01
来 源
IT技术网
Apache
本篇分享了Apache服务器中设置默认首页、虚拟目录以及身份验证,希望对于初学Apache服务器相关的朋友有帮助,更多Apache安装、配置、报错处理等资源请本站内搜索。
1、设置不同目录下使用不同的默认文件

每个<directory>都可以单独指定DirectoryIndex

如下:  

  <directory   "path1">  

  ...  

  DirectoryIndex   index.htm  

  </directory>  

  <directory   "path2">  

  ...  

  DirectoryIndex   default.php  

  </directory>  

  ......

2、添加alias,使用不同目录

Alias /files "/backup/files"

<Directory "/backup/www">

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

</Directory>

3、对Apache特定目录加身份验证

生成身份验证文件:

/usr/local/apache/bin/htpasswd -cm /etc/httpd/auth

<Directory "/backup/www">

Options Indexes MultiViews

AllowOverride None

AuthType Basic

    AuthName "www"

AuthUserFile "/etc/httpd/auth"

Require valid-user

</Directory>

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。