Sep 13, 2018

How to fix Apache web server: access denied because search permissions are missing on a component of the path

If you encounter on Apache web server for example:

Forbidden

You don't have permission to access /i88l.ca.test.html on this server.

And you check you have correct permission of the files and folder.

And you check Apache error log:

access denied because search permissions are missing
Then it maybe because of SELinux.

See also:

How to Enable or Disable SELinux on CentOS


If in the case of selinux being the issue, rather than just disable it, use the command to grant access:
chcon -R -t httpd_sys_content_t ~/public_html/

Mounting an NFS Volume For Apache Web Server

By default, NFS mounts on the client side are labeled with a default context defined by policy for NFS volumes. In common policies, this default context uses the nfs_t type. Depending on policy configuration, services, such as Apache HTTP Server and MariaDB, may not be able to read files labeled with the nfs_t type. This may prevent file systems labeled with this type from being mounted and then read or exported by other services.
If you would like to mount an NFS volume and read or export that file system with another service, use thecontext option when mounting to override the nfs_t type. Use the following context option to mount NFS volumes so that they can be shared via the Apache HTTP Server:
~]# mount server:/export /local/mount/point -o context="system_u:object_r:httpd_sys_content_t:s0"
Since these changes are not written to disk, the context specified with this option does not persist between mounts. Therefore, this option must be used with the same context specified during every mount to retain the desired context.