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:
✖ 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:
You may notice that the folder with your certificate has been generated as
example.com_ecc (where example.com 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.
Not to fear, we can easily fix this with the following commands:
Locate the file for your site:
example.com-ssl.conf (where example.com is your domain name)
Update the paths on lines starting with: ssl_certificate by adding
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.cer; ssl_certificate_key /etc/letsencrypt/example.com_ecc/vanthletic.com.key;
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:
- Check the SSL certificate Ghost generated for your site
- Locate the Nginx configuration file and add
_eccto the paths
- Restart Nginx.
Voila! Your Ghost installation will be back up and running smoothly. Happy writing!