How to restrict access to the files outside document root in apache?
Posted
by
Bakhtiyor
on Server Fault
See other posts from Server Fault
or by Bakhtiyor
Published on 2012-10-03T14:15:42Z
Indexed on
2012/10/03
15:39 UTC
Read the original article
Hit count: 185
I have virtual hosts in /var/www/site1 and /var/www/site2 folders. I want to restrict access to the files outside document root in apache virtual host, i.e. site1 could not access files of site2.
Right now this scripts in /var/www/site1 works fine, which is not good:
$filename = "/var/www/site2/somefile";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
echo $contents;
How to solve this problem please?
Thank you very much!
© Server Fault or respective owner