Setting up a self-hosted Ghost installation is a great option for many Ghost users. However, one common issue that may arise is the 'Failed to Restart Nginx' error. In this blog post, we'll explore the causes behind this error and the easy solution to fix it, allowing you to get your self-hosted Ghost installation up and running seamlessly.

When installing a new instance of Ghost on a Digital Ocean droplet (or other self-hosting), you may encounter the following error toward the end of the automated installation steps:

The Error

✖ Setting up SSL
One or more errors occurred.

1) CliError

Message: Failed to restart Nginx.

Debug Information:
    OS: Ubuntu, v22.04.2 LTS


To debug the issue, let’s look at the SSL certificate that Ghost has generated for our site. In the terminal for our server, running the following command will list the SSL certificates:

ls /etc/letsencrypt

You may notice that the folder with your certificate has been generated as example.com_ecc (where is your domain name). ECC (elliptical curve cryptography) refers to the algorithm that the SSL certificate uses.

Due to a bug when the Ghost installer generates the Nginx config for your site, it does not include the _ecc part of the path to the certificate folder.

The Solution

Not to fear, we can easily fix this with the following commands:

cd /etc/nginx/sites-available

Locate the file for your site: (where is your domain name)

Update the paths on lines starting with: ssl_certificate by adding _ecc:

ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.cer;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/;

Lastly, let’s restart Ngnix and we should be back in business:

service ngnix restart

In a nutshell, if you come across the Failed to Restart Nginx error while installing Ghost on a self-hosted environment like Digital Ocean, don’t panic! Just follow these steps:

  1. Check the SSL certificate Ghost generated for your site
  2. Locate the Nginx configuration file and add _ecc to the paths
  3. Restart Nginx.

Voila! Your Ghost installation will be back up and running smoothly. Happy writing!

Eric Alli @ericalli

Eric is the founder of LayeredCraft. He has worked as a designer and engineer for 15+ years and loves creating innovative and effective themes for all industries.