Fix Ghost File Upload Limit With CloudFlare & NGINX
2 min read

Fix Ghost File Upload Limit With CloudFlare & NGINX

Table of contents

Ghost CMS is a wonderful tool with some great built in features and error checking, and as such it is at the whims and limits of the infrastructure you run on it. In this article, we'll go over how to go around and address the file upload limit you may see in Ghost CMS.

You may have seen an error on your site when you try to upload a larger file (be it an image or theme):

The image you uploaded was larger than the maximum file size your server allows

The Solution

TLDR: Add client_max_body_size setting to NGINX and disable CloudFlare proxy mode (or get on a paid CF plan).

The reasons

You see file size upload errors because of the infrastructure that runs Ghost. Not Ghost itself (which doesn't have file limits), but the server (in this case NGINX) and the domain level stuff via CloudFlare.

Thus, we have to adjust both NGINX as well as our CloudFlare account (for this domain).

The fix & solution

There are two parts to this. First fixing up NGINX, and in my case via Nginx Proxy Manager (NPM).

The setting you need in NGINX is the client_max_body_size setting. In NPM this is set in the selected domains ADVANCED tab.

You can also see the documentation refenced here in Ghost's docs:

Though their docs don't mention NPM nor the next issue.

In my case, I just set it to 1000M (~1000 MB):

client_max_body_size 1000M;

For CloudFlare, you'll need to do one of two things:

(A) (Temporarily) Disable 'PROXY' mode (turn off the orange cloud) for the associated DNS records

or

(B) Upgrade to a paid CloudFlare plan

Why? Because CloudFlare's FREE plan only allows for 100MB file sizes (or lower).

Steps afterwards

If you've opted to disable the CloudFlare orange cloud (proxy mode) you should be able to upload a file as big as you want. Simply re-enable it once done. To remember though that once to change setting in either direction, it does take a short bit for the setting to 'set' and update itself in CF's system. So give it a few seconds (or a minute) to ensure it's set and it'll work.

💡
Youmay also have to clear your browser's cache and reload the page you're on (such as an admin page) so that your browser picks up the new settings in the network.