On Mar 26, 2014, at 10:17 AM, Bachtel, Michael wrote:

Hi all,

Some of us have had issues with Apache not serving some deployed files.

In short the issue is one with the OS's file context and was fixed by running
$ sudo restorecon -r /opt/<APP_DIR>

Longer version sourced from https://www.centos.org/forums/viewtopic.php?t=6834

"The issue is caused when you mv something from one place to another. It preserves the selinux context of the original when you move it, so if you untar something in /home or /tmp it gets given an selinux context that matches its location. Now you mv that to /var/www/html and it takes the context saying it belongs in /tmp or /home with it and httpd is not allowed by policy to access those files.

If you cp the files instead of mv them, the selinux context gets assigned according to the location you're copying to, not where it's coming from. Running restorecon puts the context back to its default and fixes it too."

~Mike

Leave a Reply