In an attempt to setup Ghost to begin this blog, I came across a strange issue after the setup "successfully" completed. When I browsed to my URL I was met with a 301 "Too Many Redirects" error.
In case you are in a similar boat, below is the basic overview of how I was configured.
- I used the DigitalOcean 1-Click Install Method.
- I use CloudFlare as my DNS Provider.
- I am using SSL.
I ran through various suggestions on the ghost forums that recommended checking my NGINX conf files, confirming I ran everything correctly in the setup script and clearing my cache. However, none of these seemed to help in my case.
Turns out it was a combination of two simple to resolve issues:
- When running the setup script I had, on the first pass, entered my site domain name rather than the full URL with "https://" appended to the front of the domain. It does pay to read the documentation...
- Since Ghost uses Let's Encrypt to generate its own self-signed certificate, CloudFlare's Flexible SSL setup is not required. I had to go into my CloudFlare settings for the site, and set the SSL option to "Full (Strict)". As soon as this was done, my site began responding correctly.
A helpful side note for anyone new to CloudFlare, you can use CloudFlare's page rules feature to do your URL redirect to HTTPS, rather than have to further edit your NGINX configuration files after setup.
See the below link to the CloudFlare documentation on using page rules: