Skip to content

Nginx settings for a Laravel site on a VPS

Servers & hosting 0 replies 0 views Started 1 week ago

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.

Join the discussion — it's free.

Sign in to reply

Are you sure?

Install ProticLink

Open the store from your home screen like an app — faster, full screen, one tap to your library and license keys.

Choose which optional cookies we may use. You can change this at any time from the footer.

Strictly necessarySign-in, security, your cart and checkout. These cannot be switched off. Always on