server {
    listen 80;
    server_name tr143.venko.local;

    root /var/www/tr143;
    index index.html;

    # Adjust the client_body_temp_path to the tmpfs mount
    client_body_temp_path /run/nginx_temp;

    location /download/ {
        alias /var/www/tr143/download/;
        autoindex on;
        add_header Content-Disposition 'attachment';
    }

    location /upload/ {
        client_max_body_size 1000M;
        alias /var/www/tr143/upload/;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root/upload.php;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
    }

    location ~ \.php$ {
        # Configure PHP if using PHP for file uploads
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
    }
}