ProticLink
Team
1 week ago
#1
A minimal Nginx server block for Laravel:
server {
server_name example.com;
root /var/www/app/public;
index index.php;
client_max_body_size 200M;
location / { try_files $uri $uri/ /index.php?$query_string; }
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.4-fpm.sock;
}
location ~ /\.(?!well-known) { deny all; }
}The root must point to public, never to the project folder — otherwise your .env could be downloaded.