Receiving error while assembling chunks, status code 504

We have a nextcloud installation running on Apache. Whenever a large file, around 15GB is uploaded, it throws an error

error when assembling chunks, status code 504