I have two pdf files in my server:
-rwxr-xr-x. 1 apache apache 1422861 Sep 11 2014 file1.pdf
-rwxr-xr-x. 1 apache apache 340815 Aug 27 13:06 file2.pdf
I can access the first one by going to www.myserver.com/pdffiles/file1.pdf
I just uploaded the second one and changed permissions to apache:apache and rwxr-xr-x so I wouldn't have problems with permissions, but when I try to access the second file with www.myserver.com/pdffiles/file2.pdf I get this:
Forbidden
You don't have permission to access
/pdffiles/file2.pdf on this
server.
What am I missing?
I got the following on my ssl_error_log:
[Thu Aug 27 13:30:46.755295 2015] [core:error] [pid 3025]
(13)Permission denied: [client x.x.x.x:60230] AH00132: file
permissions deny server access: /var/www/myserver/file2.pdf
Best Answer
I didn't know the problem was SELinux but I discovered that was the problem because I turned it off with
setenforce 0
and then it worked. This is how it looked when I listed the files withls -alZ
so I fixed it with:
and also I turned SELinux back on with
setenforce 1
.