'proxy_fcgi:error AH01071: Got error 'Unable to open primary script: /var/www/html/laravel/public/index.php (Permission denied)'
I have a website hosted using Apache in Azure. I was trying to access the website with http://example.com/laravel/public and it's showing me "Access denied" message and when I checked for the error log message, it's showing a proxy_fcgi:error AH01071 message as stated in the title. I am not sure if it's the htaccess configuration issue or other configuration which causes this issue. Please help.
In my .htaccess, I have the following configured:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Solution 1:[1]
Seems like php-fpm does not have read permission on index.php
You could run the following on a terminal to know which user is actually running php-fpm :
# ps aux | grep php-fpm | awk '{print $1}'
You could then give permission on index.php to this specific user with the following (replace <php_fpm_user> with the result of the first command):
# setfacl -m u:<php_fpm_user>:r /var/www/html/laravel/public/index.php
Solution 2:[2]
In some cases this can be caused by SELINUX being set to ENFORCING... you can either disabled SELINUX (reboot required) or add the corresponding SELINUX policy.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | jascar_destin |
Solution 2 | jepachecoh |