将子域限制为root访问权限


Restrict subdomain to root access

是否可以限制子域访问其父域?例如我有一个名为example.com的域,其文件位于/public_html中那么我有一个子域,name.example.com,它位于/public_html/name中。现在我想阻止子域中的文件以各种方式访问父域中的文件。因此,这包括JavaScript和PHP,但子域和父域都允许使用PHP对此有什么解决方案吗?

提前感谢

您应该配置您的apachehttpd.conf文件,请参阅安全提示

<Directory />
    Require all denied
</Directory>

这将禁止默认访问文件系统位置。添加适当的目录块,只允许在您希望的区域进行访问。例如,

<Directory /usr/users/*/public_html>
    Require all granted
</Directory>
<Directory /usr/local/httpd>
    Require all granted
</Directory>