For whatever reason Nginx doesn't like images larger than one megabyte on my little Raspberry Pi servers. More specifically, it doesn't like it when going through a reverse proxy to my self-hosted Ghost blog (this site you're reading now). So, let's fix that.

As noted above I'm using Nginx for my web server(s). I'm not getting technical in this post; this is just an add this, change this post.

First thing we're going to change is your server block. For me, I'm doing this in two (well, technically three) locations. The first is on my reverse proxy server block on my Nextcloud server which pushes to my Ghost server. So, on server one;

sudo nano /etc/nginx/sites-available/sitename

Add the line client_max_body_size 10240M; in the head just below your server name so it looks something like this:

This is my whole reverse proxy setup. After setting your size option you need to restart Nginx using

sudo service nginx restart

If you get an error you can figure out where it is using the Nginx test function of sudo nginx -t which will give you the line the error is on.

Next, we need to update our Ghost server block(s).

The nice part is when Ghost auto-creates these files they already place the client_max_body_size tag into the file. It's default is 50m; it doesn't really matter what you put it at so long as it matches across the board. As I updated my reverse proxy server block with 10240 megabytes (10 gigs) I want to make sure I put these at the same. Here's what the port-80 file (non SSL) looks like (look at the bottom)

When working with Ghost, and you've elected to enable SSL, there will be two server block files made in /etc/nginx/sites-available/;

  1.; and

You'll have to update both of these (hence the technical three places mentioned at the beginning) or you might run into some issues. As before, you'll also need to restart Nginx for it to take effect;

sudo service nginx restart

You should now have no issues with uploading those awesome large cat photos you want to post to the world!