GodziLaravel's avatar

You don't have permission to access this resource.

I have a problem to deploy my laravel 9 application, I get the error 403

Forbidden
You don't have permission to access this resource.

I(m wondering If I forgot something !

After these modifications I restarted the apache2 server but it stills not working !

In apache2.conf

AccessFileName .htaccess

<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

in 000-default.conf

<VirtualHost *:80>
    
    ServerAdmin webmaster@localhost
    DocumentRoot /home/me/www/click-project/public

    <Directory /home/me/www/click-project/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
            Require all granted
     </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

In /home/me/www/click-project/public/.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
0 likes
1 reply
abolfazlahmadiweb's avatar
sudo chown -R :www-data /var/www/myproject
sudo chmod -R 775 /var/www/myproject/storage
sudo chmod -R 775 /var/www/myproject/bootstrap/cache

Please or to participate in this conversation.