I already went through that. I wouldn’t post here without starting with the official documentation.
Comment on I'm deploying a Laravel app on nginx. Only the main route works, every other throws me a 404
BaalInvoker@lemmy.eco.br 2 months ago
I’m not sure, but looks like you’re denying all .htaccess files. Laravel depends on .htaccess to make things work properly
Take a look on Laravel docs - Deployment to make sure your configs are right
spirinolas@lemmy.world 2 months ago
BaalInvoker@lemmy.eco.br 2 months ago
Why are you using that?
location ~ /\.ht { deny all; }
You’re denying the access to your root, which is the
public/
folder and has the file.htaccess
that has<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>
This file handles the income requests and send to the front controller.
fluckx@lemmy.world 2 months ago
The .htaccess file does nothing on nginx though.
tahoe@lemmy.world 2 months ago
As far as I know only Apache uses .htaccess files, Nginx works a different way
BaalInvoker@lemmy.eco.br 2 months ago
Oh, I wasn’t aware of that. I have no experience whatsoever with nginx. I thought that .htaccess was universal
tahoe@lemmy.world 2 months ago
I was the same until like two months ago when I had to learn Nginx!