I have a VPS with CentOS and I'm facing a very strange behavior by Apache webserver.
I started this server with 50GB of disk space and soon I ran out of space so I asked maintenance department and they added another 50GB as a new hard drive. So I created a new partition and mounted it in /home/media and I moved all my website media files to this place and at the end I created an SymLink like this:

lrwxrwxrwx. 1 apache apache 12 May 15 14:07 media -> /home/media/

Today, I ran out of disk space once more and they did added a new hard drive with 100GB capacity this time. I just wanted to do the same as I did for /home/media/ but this time it's called /data/media.

lrwxrwxrwx. 1 apache pooya 12 Jun 9 22:43 media -> /data/media/

Now when I navigate to files in media folder in browser, I get Forbidden 403 error.

I checked Apache's error log and it says: Symbolic link not allowed or link target not accessible: /var/www/html/media.

All the solutions for this error on Internet is to add Options Indexes FollowSymLinks or webserver facing access problems with symliked directory.

I have the FollowSymLinks in both apache config file and my root .htaccess file. All the files and folders and also their parents in /data/media/ are chmodded to 777 and the chown of them is apache:apache.

Line what? I just created a new partition, mounted it to /data/ and then copied media folder from /home to here. What should I do? It's a production website and now I'm stuck in a bad situation!
–
faridvJun 9 '13 at 20:15

When I type ls -Z in /data/ folder I get drwxrwxrwx. apache apache unconfined_u:object_r:file_t:s0 media. I have no idea what does it mean. Can it help me finding the problem?
–
faridvJun 9 '13 at 20:18

1

@faridv: You have 2 problems. The first Symbolic link not allowed or link target not accessible: /var/www/html/media appears to be caused by SELinux and I've provided an answer to that question. The second Premature end of script headers is an entirely different problem and it's resolution is much more difficult to diagnose remotely and is more likely an application/programming error.
–
IainJun 9 '13 at 20:23