打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Apache 建立、修改虚拟目录和设置默认页面
Apache 建立、修改虚拟目录和设置默认页面
2009-01-14 21:23

建立虚拟目录

1.找到"conf/httpd.conf" 文件
2.在httpd.conf里面加了如下语句

Alias /anstyla "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web">
          Options Indexes MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
</Directory>

在此模块下建立虚拟目录,Alias /虚拟目录名称/ "虚拟目录路径,以[/]代替[\]"

例如:Alias /admin "D:/web/admin/"

(*)/admin 为虚拟目录名称,一般不用在名称后加"/",若加入,每次都要在虚拟目录后输入"/"才能访问网站;D:/web/admin/ 为虚拟目录的物理路径.

3.重启Apache
这步最重要,常常忘了,呵呵.

或参考:

在配置文件中找下面这行:<IfModule mod_alias.c>
在这行下面添加如下内容:
Alias /vdir/ "c:/dir/"
<Directory "c:/dir/">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
以后通过http://localhost/vdir/就能访问到c:\dir\下的内容了.

修改虚拟目录

找到APACHE安装目录下的conf目录下的httpd.conf文件,将其中的:
(用记事本打开,并查找DocumentRoot)

DocumentRoot 后面的目录改为你所需的目录即可!

下面还有一处
<Directory "c:/apache/apache2/htdocs">
也要改

然后重新启动服务

设置默认页面

方法1 设置全局的:
<IfModule dir_module>
    DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml default.php
</IfModule>

方法2 针对某一目录可以这么设置:

Alias /anstyla "E:/anstyla/src/web"
<Directory "E:/anstyla/src/web">
          Options Indexes MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
          DirectoryIndex default.php
</Directory>

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
WampServer使用手册
Apache 虚拟目录、默认首页的设置
windows环境下wampserver的配置教程——超级详细
使用alias配置APACHE2.2虚拟目录
在Ubuntu Linux 上架设Web服务器详解
Eclipse开发PHP调试(debug)环境配置
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服