大概在二十年前,我就这么做了,但我现在似乎想不通。我想Apache需要一个指令--最好是在一个 <Directory>
容器--否则它认为打开文件权限是配置错误,但我今天不知道怎么做。
说明一下,我想做的是把一个链接指向一个没有html文件的目录,让用户浏览那里的文件并下载,"读",但没有写的权限。如果在那个目录下,就可以让任何人阅读,只是不能新建文件,也不能修改现有文件。
第二天早上喝咖啡的时候,我意识到可以在 httpd.conf 中找到一个很大的帮助,果然在那里有一个关于这个问题的注释,它指向了 这在文档中。
然后我意识到需要为 "Indexes "目录添加一个异常,描述为。
> Indexes
> If a URL which maps to a directory is requested and there is no DirectoryIndex (e.g., index.html) in that directory, then
> mod_autoindex will return a formatted listing of the directory.
所以...
我尝试了一下。
<Directory "/the/dir">
Options Indexes
</Directory>
然后... $ apachectl graceful
然后又试了试,成功了!