【问题标题】:Restrict subdomain to root access将子域限制为 root 访问
【发布时间】:2014-01-04 19:11:45
【问题描述】:

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

提前致谢

【问题讨论】:

    标签: php dns web subdomain restrict


    【解决方案1】:

    您应该配置您的 apache httpd.conf 文件,请参阅Security Tips

    <Directory />
        Require all denied
    </Directory>
    

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

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

    【讨论】:

    • 谢谢,提供信息,我猜它会起作用,但遗憾的是我不能使用这个解决方案。我与托管服务提供商的工作人员进行了交谈,并且正如我所料,他们不允许您更改配置文件
    猜你喜欢
    • 2014-02-05
    • 1970-01-01
    • 2014-08-10
    • 2015-10-07
    • 1970-01-01
    • 2011-12-31
    • 2013-07-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多