Apache 下更改 DocumentRoot 和新建虚拟目录
2012-12-29 21:12
441 查看
转:原文地址
my word:经过我的实践,这个方法是可行的。
my word:经过我的实践,这个方法是可行的。
Apache 安装后,默认的 DocumentRoot 是安装目录下的 htdocs 目录,编程时有很多不便,如需更改,打开安装目录 conf 子目录下的 httpd.conf 文件,修改 DocumentRoot 属性即可,如更改为:DocumentRoot “E:/My/DocRoot”。
在 IIS 下,新建虚拟目录可通过可视化界面操作,在 Apache 中,新建虚拟目录通过修改 httpd.conf 文件实现。
在 httpd.conf 的 alias_module 下增加一别名定义项,如:Alias “/onefly” “E:/My/Onefly” ,即可定义虚拟目录。
更改以上设置后,必须重启 Apache 才能使设置生效。同时,要对相应目录作权限定义,否则会出现无权访问的错误提示。
要对目录定义权限,可在 httpd.conf 文件中定义类似以下的代码:
<Directory “E:/My/Onefly”>
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
=======================================================================
自己机器上配置实例如下:
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.waydu.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
##################################################################
Alias /study "D:/PHP/www/study"
<Directory "D:/PHP/www/study">
Options Indexes Includes FollowSymLinks MultiViews IncludesNoExec
AllowOverride None
Order allow,deny
Allow from all
</Directory>
##################################################################
相关文章推荐
- Apache 下更改 DocumentRoot 和新建虚拟目录
- Apache 下更改 DocumentRoot 和新建虚拟目录
- Apache 下更改 DocumentRoot 和新建虚拟目录
- Apache 在更改DocumentRoot,或新增虚拟目录之后出现403错误的解决方法汇总详解(Linux)
- xampp 下更改DocumentRoot 和新建虚拟目录
- Apache 在更改DocumentRoot,或新增虚拟目录之后出现403错误的解决方法汇总详解(Linux)
- Apache 在更改DocumentRoot,或新增虚拟目录之后出现403错误的解决方法汇总详解(Linux)
- Linux更改Apache网站目录出错:Document root must be a directory
- Windows更改Apache网站目录出错:Document root must be a directory
- Linux更改Apache网站目录出错:Document root must be a directory解决
- 设置 Apache HTTP Server 的文件根目录(DocumentRoot)
- 更改Apache虚拟目录
- centos7解决apache更改DocumentRoot后无法访问的问题
- 1:wamp如何更改网站根目录DocumentRoot 2:php的error_log文件(txt)会每秒几十K增大
- 设置修改 Apache 文件根目录 (Document Root)
- linux apache 新建两个虚拟目录
- 设置修改 Apache 文件根目录 (Document Root)
- Apache 文件根目录设置修改方法 (Document Root)
- 修改 Apache 文件根目录 (DocumentRoot)
- 如何设置 Apache HTTP Server 的文件根目录(DocumentRoot)