我试图保护 apache 中的 mod_userdir 模块..
目前我的用户站点的目录结构是
/home/{user}/domains/{domain}/public_html/site
问题是,我的许多用户存储了不应该存储在 /domains/ 目录中的文件(私有文件),但他们确实这样做了,并且 id 宁愿绕过它而不是让他们移动它们。
基本上我拒绝访问/{domain}/ 中的所有目录,除了public_html,但是仍然可以查看文件。
这是我的 usermod.conf 配置。
<IfModule mod_userdir.c>
UserDir /home/*/domains
UserDir disabled root
<Directory /home/*/domains/*/*>
Order allow,deny
Deny from all
</Directory>
<FilesMatch /home/*/domains/*/*>
Order deny,allow
Deny from all
</FilesMatch>
<Directory /home/*/domains/*/public_html>
Order allow,deny
Allow from all
</Directory>
<Directory /home/*/domains>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from …
Run Code Online (Sandbox Code Playgroud)