jake@hz-ubuntu-wordpresse:/etc/nginx/sites-available$ ls -Flai /etc/nginx/sites-enabled
total 12
660107 drwxr-xr-x 2 root root 4096 Jun 6 21:07 ./
659600 drwxr-xr-x 8 root root 4096 Jun 5 13:21 ../
660316 lrwxrwxrwx 1 root root 34 Jun 5 13:21 default -> /etc/nginx/sites-available/default
683054 -rw-r--r-- 1 root root 559 Jun 6 19:47 ghost.jakereed.co.uk.conf
jake@hz-ubuntu-wordpresse:/etc/nginx/sites-available$ ls -Flai /etc/nginx/sites-available
total 16
659931 drwxr-xr-x 2 root root 4096 Jun 5 13:35 ./
659600 drwxr-xr-x 8 root root 4096 Jun 5 13:21 ../
660089 -rw-r--r-- 1 root root 2416 Mar 26 2020 default
296600 -rw-rw-r-- 1 jake jake 511 Jun 5 14:11 ghost.jakereed.co.uk.conf
jake@hz-ubuntu-wordpresse:/etc/nginx/sites-available$
If I set NPM scheme to https, forward port to 443 and proxy pass to port 80 under NPM advanced nginx config then I get a message to say there are too many redirects. I realise I probably don’t want to pass port 80 but like I said i’ve been trying just about every different combination I can think of!
The rest of the time I normally get a 502 bad gateway Cloudflare page to say there’s a problem on my server end.
jake1:
I feel like I’m quite close but I’m just not 100% sure what values I should be using on Cloudflare / Nginx Proxy Manger / the site.conf file under sites-enabled folder.
Using ghost install
correctly will set this up for you out-of-the-box. However, you seem to be doing something different to the guide, e.g., using Nginx Proxy Manager, which isn’t needed.
jake1:
Happy to start over if it’s helpful but not sure what I will have done differently as I have been using nginx from the start as opposed to Apache like the other post.
If you read the thread (from the post I referenced) you will understand that the first part of the thread was rolling back, so a clean installation could take place.
jake1:
If I start over, when Ghosts asks me if I want to install nginx is there any benefit to installing this if I’m using a separate reverse proxy?
Ghost doesn’t install Nginx–it is a prerequisite–but it does configure the site an SSL for the given domain. Moreover, Nginx is a reverse proxy.
Ghost runs on the local host, e.g. 127.0.0.1:<some port>
and Nginx is used to proxy this to http or https (recommended.) http is port 80 whereas http is on port 443; these ports are exposed to the Internet whereas the Ghost port is not.
jake1:
UFW - not enabled…
You need to harden any server that is accessible to the Internet, more so with an application such as Ghost that can be set up as a bulk mailer. However, it looks like you are using a VM on your home network, so this should already be behind a firewall in your router; just make sure 80 and 443 are open and forwarded to the VM.
jake1:
Output from mariadb / mysql below
You are using MySQL, not MariaDB. This is an important distinction since Ghost only supports MySQL 8.0.
jake1:
If I set NPM scheme to https, forward port to 443 and proxy pass to port 80 under NPM advanced nginx config then I get a message to say there are too many redirects. I realise I probably don’t want to pass port 80 but like I said i’ve been trying just about every different combination I can think of!
The rest of the time, I normally get a 502 bad gateway Cloudflare page to say there’s a problem on my server end.
This is to be expected since you have a broken Nginx configuration.
If you haven’t already used Ghost, I think the best option is to start over. The thread I posted covers this for Ubuntu 20.04. The only difference is the OP wanted Ghost V4 whereas you can install V5 by omitting the 4.48.1
,
To tidy up Nginx, remove the symbolic links to the Ghost site in /etc/nginx/sites-enabled
and delete the borked configuration file in /etc/nginx/sites-available
. Ignore or uninstall Nginx Proxy Manager since it is unnecessary.
You’ll almost certainly need to clear cookies in your web browser to prevent the unwanted redirects reoccurring.
Edit: I note your root domain is resolving fine. If you want to use Cloudflare instead of ACME (Let’s Encrypt etc.) then you’ll need to set up Cloudflare Origin Server certificates including a certificate request (CSR), and manually configure Nginx. If you’ve set up your root domain certificate with a wildcard, you may use this. Please reach out to me, and I can give you the Nginx configuration, since this is how I handle SSL.
I ended up using the Ghost Docker image and I got it working quite easily using my same Nginx Proxy Manager on a different server.
Everything is being served over HTTPS and everything is working.
I’m sure it is possible to get it working the way I was initially trying but I’m quite happy running it in Docker anyway so will stick with this!
I had a similar problem, setting the SSL/TLS encryption mode to Full (strict) solved the problem.