Apache 添加虚拟目录注意事项
程序员文章站
2022-05-29 21:50:00
问题:配置apache,httpd.conf 添加虚拟目录 alias /sww/ "c:/xampp/htdo...
问题:配置apache,httpd.conf
添加虚拟目录
<ifmodule alias_module>
alias /sww/ "c:/xampp/htdocs/test/"
</ifmodule>
出现限制权限访问,
access forbidden!
you don't have permission to access the requested object. it is either read-protected or not readable by the server.
if you think this is a server error, please contact the webmaster.
error 403
localhost
2011/8/26 17:36:49
apache/2.2.17 (win32) mod_ssl/2.2.17 openssl/0.9.8o php/5.3.4 mod_perl/2.0.4 perl/v5.10.1
需添加目录设置
<directory "c:/xampp/htdocs/test/">
allowoverride none
options none
order allow,deny
allow from all
</directory>
尝试:
1. 将c:/xampp/htdocs/test/的/去掉,结果:无法启动apache
2. 将c:/xampp/htdocs/test/的/改成\,结果:无法启动apache
3. 将c:/xampp/htdocs/test/改为"d:/work/booksir/bp/code/user_booksir_com_cn/trunk/",结果:无法启动apache
4. c:/xampp/htdocs/test/文件夹有everyone完全控制权限,给d:/work/booksir/bp/code/user_booksir_com_cn/trunk加上everyone的完全控制权限,结果:仍无法启动apache
5. 将"d:/work/booksir/bp/code/user_booksir_com_cn/trunk/"的/去掉,/sww/的/去掉,结果:成功启动apache
结论:
最好
alias /sww "d:/work/booksir/bp/code/user_booksir_com_cn/trunk"
<directory "d:/work/booksir/bp/code/user_booksir_com_cn/trunk">
后面都不要加/,都不要使用\,这样比较保险
# if you include a trailing / on /webpath then the server will
# require it to be present in the url. you will also likely
# need to provide a <directory> section to allow access to
# the filesystem path.
添加虚拟目录
<ifmodule alias_module>
alias /sww/ "c:/xampp/htdocs/test/"
</ifmodule>
出现限制权限访问,
access forbidden!
you don't have permission to access the requested object. it is either read-protected or not readable by the server.
if you think this is a server error, please contact the webmaster.
error 403
localhost
2011/8/26 17:36:49
apache/2.2.17 (win32) mod_ssl/2.2.17 openssl/0.9.8o php/5.3.4 mod_perl/2.0.4 perl/v5.10.1
需添加目录设置
复制代码 代码如下:
<directory "c:/xampp/htdocs/test/">
allowoverride none
options none
order allow,deny
allow from all
</directory>
尝试:
1. 将c:/xampp/htdocs/test/的/去掉,结果:无法启动apache
2. 将c:/xampp/htdocs/test/的/改成\,结果:无法启动apache
3. 将c:/xampp/htdocs/test/改为"d:/work/booksir/bp/code/user_booksir_com_cn/trunk/",结果:无法启动apache
4. c:/xampp/htdocs/test/文件夹有everyone完全控制权限,给d:/work/booksir/bp/code/user_booksir_com_cn/trunk加上everyone的完全控制权限,结果:仍无法启动apache
5. 将"d:/work/booksir/bp/code/user_booksir_com_cn/trunk/"的/去掉,/sww/的/去掉,结果:成功启动apache
结论:
最好
alias /sww "d:/work/booksir/bp/code/user_booksir_com_cn/trunk"
<directory "d:/work/booksir/bp/code/user_booksir_com_cn/trunk">
后面都不要加/,都不要使用\,这样比较保险
# if you include a trailing / on /webpath then the server will
# require it to be present in the url. you will also likely
# need to provide a <directory> section to allow access to
# the filesystem path.