How to fix Internal Server Error when uploading an image to Ghost

Recently I moved another blog - the Brain Archives - from to Digital Ocean.

The migration went smoothly. The support exported everything for me. Then I imported the posts and settings using the built-in importer. You are supposed to use the importer for images as well. Unfortunately it doesn't work with large files, and often such import ends with an error.

The recommended solution is to split large files into smaller ones and import those. I didn't want to spend time splitting a couple of hundreds of Megabytes into smaller packages. Instead, I decided to use the old and good FTP. I connected with my server and copied all my images directly to the Ghost's content/images/ folder.

At this point, everything was working perfectly fine. The new instance of the blog had all the previous content, and everything was served as intended, including the images.

The next day I wrote a new post, and when I tried to upload the post's image, I got the Internal Server Error:

         "message":"Resource not found",

A quick googling later, it turned out that this error occurs when Ghost can't save the image inside the content folder. Usually, it's caused by invalid or missing permissions.

Ghost uses the ghost user to access and modify the blog's content. In my case, I probably copied the images folder with permissions for a different user, which was preventing Ghost from saving the image.

Fortunately, there is a quick fix for this issue:

  1. SSH and login to your server,
  2. Navigate to Ghost's folder,
  3. Grant the ghost user the permissions to all files and subfolders inside the content folder using the chown command:
sudo chown -R ghost:ghost ./content

That's it. Now you should be able to upload a new image.

None of the mentioned products is sponsored in any way, but the post contains affiliate links. If you buy any of these products using the links from this post, I will get something in return from the maker. If you don't like this, just search for those products, and go to their websites yourself.


Anything interesting to share? Write a comment.