server {
    server_name DOMAIN;
    server_name_in_redirect off;

    root /var/www/web/sites/PROJECT_FOLDER;
    index index.html index.php;
  
    access_log /var/log/nginx/DOMAIN.access_log;
    error_log /var/log/nginx/DOMAIN.error_log info;

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

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    add_header X-Content-Type-Options nosniff;
    
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
        return 403;
        error_page 403 /403_error.html;
    }

    location ~* \.(ico|pdf|flv)$ {
        expires 1y;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
        expires 14d;
    }
}