Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 783
doremi666 Avatar asked Oct 28 '25 04:10

doremi666


1 Answers

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

like image 101
jascar_destin Avatar answered Oct 30 '25 19:10

jascar_destin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!