Apache下网站文件夹的权限设置

2 分钟 阅读

权限设置永远是让人头疼的事情,昨天想在Apache下直接见一个vhost,把它mapping到非Apache DocumentRoot下的一个文件夹,结果一直给这个错误

client denied by server configuration

搞的稍微有点郁闷,Google到的东西也很多不靠谱,直到在Apache官网上看到

  • The default Apache config includes Deny from all in the <Directory> block the DocumentRoot - this must be changed to allow access!
  • If you change the DocumentRoot, you will need to change the <Directory> block referring the old root, to the refer to the new root
  • You need a <Directory> block for every folder outside of your DocumentRoot, i.e. your cgi-bin folder.
  • You need a <Directory> or <Location> block for every Alias.
  • You need a <Location> or <Proxy> block for your proxy

最最关键的是这句:

You need a <Directory> block for every folder outside of your DocumentRoot

在虚拟目录上给每个父文件家都配置上<Directory>,才算完成

留下评论