Restrict subdomain to root access

308 views Asked by At

is It possible to restrict a subdomain from accessing its parent domain? For example I have a domain called example.com which files are in /public_html then I have a subdomain, name.example.com, which is located in /public_html/name. Now I want to prevent the files in the subdomain from accessing the files in the parent domain in every way. So , that includes, JavaScript and PHP, but PHP is allowed on both the subdomain and parent domain any solutions for this?

thanks in advance

1

There are 1 answers

1
Ignacio Ocampo On

You should configure your apache httpd.conf file, please see Security Tips

<Directory />
    Require all denied
</Directory>

This will forbid default access to filesystem locations. Add appropriate Directory blocks to allow access only in those areas you wish. For example,

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