Ok, next step is to see how to install the nginx proxy thing. Nick had linked to HOWTO run a private PHP-FPM stack on Nginx or Apache on Opalstack and so I'm reviewing this.
A couple points of confusion arise, as I'm not very familiar with nginx or proxies.
- The example seems to assume that I want to run a php-fpm application, and that nginx is being proxied so I can edit the nginx conf to add my own specialty configuration. However, Ghost is a Node JS application, not PHP.
- Creating a second app of type Nginx Proxy Port which somehow binds to another site,
- The repo at the github.com/opalstack/private-phpfpm-installer has two files,
config which we edit and install.bash which we run using ./install.bash from inside the cloned repo. However, looking at both config and install.bash these seem to be checking specifically for PHP variables and install locations.
I don't think this will have any bearing on my NodeJS-based Ghost application. But maybe the part that actually works is the nginx template being modified by the bash script and that's what matters; the rest of the stuff is just extra dangly bits.
That said, the reason I was having trouble before was because I had installed Ghost on a subdomain or directory and this broke its Network (federation) feature. Digging around in the Ghost forums, someone suggested that extra configuration in nginx that isn't normally editable on Opal.
However, I reinstalled my Ghost app on a regular domain, and the Network feature in Ghost seems to be working now instead of timing out. So I don't need to install the nginx proxy at all now, and can skip it.
So I guess I'm good! Just to summarize this nginx proxy stuff for the future, my understanding is
- Creating an APPLICATION from the "nginx proxy port" stack makes a special entry with a generated port; the application itself has no files in it by default.
- By creating a SITE, I connect a DOMAIN to an APPLICATION (in this case, the nginx proxy port app)
- SOMETHING MAGICAL HAPPENS TO LINK NGINX TO GHOST
- The proxy directs traffic to and from the Ghost application port, like a regular NodeJS application running behind a proxy.
Looking through the script, I guess the magic is this chunk from install.bash
cat << "EOF" > start-nginx
#!/bin/bash
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$MYDIR/php-fpm --prefix "$(dirname $MYDIR)"
$MYDIR/nginx -c "$(dirname $MYDIR)/conf/nginx.conf" -p "$(dirname $MYDIR)" 2>/dev/null
EOF
This creates a script that runs nginx -c with the custom configuration and serves from dirname $MYDIR, but I think with Ghost that this isn't actually what needs to happen since it's what is serving web traffic, not from a location? So the necessary nginx configuration for Ghost might be different.