I can't get apache to follow symlinks outside the web root directory, even though permissions look OK and FollowSymLinks is on. The details are below.
I have two world-readable text files: /tmp/hello
and /var/www/html/hello
.
Also in webroot I have symlinks to both those files. Both seem fine.
$ ll /tmp
drwxrwxrwt. 27 root root 4096 Jul 8 13:55 ./
dr-xr-xr-x. 23 root root 4096 Jul 4 23:24 ../
-rw-r--r--. 1 root root 6 Jul 8 13:55 hello
$ ll /var/www/html
drwxr-xr-x. 3 root root 4096 Jul 8 13:56 ./
drwxr-xr-x. 6 root root 4096 Apr 4 12:57 ../
-rw-r--r--. 1 root root 20 Jul 8 14:03 hello
lrwxrwxrwx. 1 root root 5 Jul 8 14:04 link-local -> /var/www/html/hello
lrwxrwxrwx. 1 root root 10 Jul 8 13:56 link-tmp -> /tmp/hello
$ cat /var/www/html/link-local
/VAR/WWW/HTML/HELLO
$ cat /var/www/html/link-tmp
/TMP/HELLO
Apache can follow the link to the web root:
$ curl http://localhost/link-local
/VAR/WWW/HTML/HELLO
But Apache won't follow the symlink to /tmp/
:
$ curl http://localhost/link-tmp
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /hellolink on this server.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at localhost Port 80</address>
</body></html>
This is on CentOS 6; http runs as user apache, group apache.
Why is this happening? How can I fix it?