Laravel nginx

From AWVVO
Jump to navigationJump to search

Create config file

server {
    listen 80;
    server_name your-domain.com;

    root /var/www/your-laravel-app/public;

    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Adjust version if needed
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

    access_log /var/log/nginx/your-app.access.log;
    error_log /var/log/nginx/your-app.error.log;
}