Apache, Proxy and VirtHost - Fastrack Request

I’m hoping someone can provide some guidance to help me fasttrack getting Ghost up and running so I can verify feature functionality for our requirements.

In short I have a few setup issues that I see in the forums and online but I have not found the right sequence of changes to get a vanilla ghost running.

My two obvious symptoms. The Home, About, and Ghost menu links are localhost:2368,
sign in and subscribe are URL (but don’t work).

My config is nodejs 1.18 under Apache vhost and trying to configure mod_proxy and latest ghost (via the installer).

Clearly the localhost links wrong, I’ve tried a few variations with the config.development.json file with little success.

I’ve also tried a few variations I’ve found on the forums for the Vhost-Proxy configuration. with little success.

I see others are using this basic configuration, Is anyone willing to share their working ghost config file and their vhost/proxy settings?

I really need to get this vanilla config running today or I’ll have to move on to other candidates.

Thanks in advance

Eric.

Any reason you’re using Apache? Nginx is the perfect reverse proxy for Ghost.

1 Like

Been using it for 30 years, its well vetted. Shouldn’t really make a difference should it? What make nginx better/different than Apache?

specifically with respect to getting vanilla ghost running.

Nginx is officially recommended for production, and there’s good reason for this, especially on a virtual host with limited memory. Moreover, Nginx was designed as a reverse proxy and that is what you need for Ghost. It’s a doddle to set up and maintain.

So, yes, it does make a difference, and using a general purpose web server as a reserve proxy, whilst possible, is not so straightforward, as your post has demonstrated.

Thanks. All good feedback, and I’m open to reevaluating a production config. I just need to demo. I’ve seen others with the same config inquires and implications they have it working. Do you know if it can or won’t work under Apache proxy? I’m not up to reconfiguring my sever just to demo this.

I’m sure Apache could be made to work, but none of the mods most actively answering questions use it.

If your priority if speed, and you are stuck configuring Apache, there are lots more resources out there for using Ghost with Nginx.

I used Apache for about 20 years myself. It was rock solid. But Nginx has been honestly more pleasant to manage and good riddance to mod_rewrite voodoo. Sounds like now is a good time to take a look.

I shut down all my websites, loaded nginx and configed it. Getting 502 bad gateway. Where are the logs?

Sorry, just frustated. Had ghost running in dev env, but had to run 5.7 for node16. No comments, which is a requirment test. Now for Node 18. I’ve stood up a new vps, installed a newer os. Got apache and website running, but ghost refuses to cooperate. Shut down all the sites and installed nginx and it’s fighting me. I’m out of time and patience. Gonna move on in the next our or two if I can’t get the site to just load.

Can someone post a default working config for NGINX.

here’s my setup.
nginx.conf
server {
listen 0.0.0.0:80;
server_name www.blah.com;
access_log /var/log/nginx/blah.com.log;

    location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header HOST $http_host;
    proxy_set_header X-NginX-Proxy true;

    proxy_pass http://127.0.0.1:2368;
    proxy_redirect off;
    }
}

/var/www/ghost/config.development.json

{
“url”: “http://localhost:2368/”,
“server”: {
“port”: 2368,
“host”: “localhost”
},
“database”: {
“client”: “sqlite3”,
“connection”: {
“filename”: “/var/www/ghost/content/data/ghost-local.db”
}
},
“mail”: {
“transport”: “Direct”
},
“logging”: {
“transports”: [
“file”,
“stdout”
]
},
“process”: “local”,
“paths”: {
“contentPath”: “/var/www/ghost/content”
},
“URL”: “http://www.blah.com
}

/var/log/nginx/access.log

journalctl -u ‘ghost

with chatgpt’s help, it’ finally loads, but I’m back at the original step. Proxy isn’t working. links say localhost and signin doesn’t work. This has to be a ghost issue. Same exact behavior in apache and nginx.

Still hoping for experienced insight.

or at least How I’m configuring ghost…

I found this link, but no details as to what to change

That’s the last place you should go for assistance. Always start withe tge official guides.

Unlikely, or all those Ghost sites running would run into the same problem.

Care to share some tangible feedback, other than it’s not working?

The most obvious issue is the URL with port in the config. You’re proxying localhost:port, so the port isn’t specified. Moreover, if you’re using a VPS surely you are on a domain?

1 Like

The official Ghost CLI installer takes care of creating both a valid Nginx config for you as well as an SSL cert. Did you try it?

Thanks to everyone for their assistance. Once I figured out the ghost config I got it working.

I really had to jump through some hoops to get ghost up and running. Purchased a new VPS, installed a newer OS, had to downgrade the php. Install Nginix from scratch as a newbie. Then the ghost’ism components. It seems to work fine with apache. I’m not sure why so much support resistance. I certainly didn’t do a thorough dive into the features under apache. I don’t doubt there might be some compatibility issues.

I was really hopeful since there are few self-hosted publishing products out there. I liked the ease a non-web user could quickly take control of publishing content. In the end. What drove me to ghost was the comment capabilities. There are lots of comment “widgets” out there, but self-hosting was a requirement. So built in comments with local dB was a big plus.

Where ghost lost me was on the user interaction. The users are already authenticated (and we have dB persistence, for management) , but the required email to login to the site every time was too awkward. I’d still love to integrate the product, if I could disable that email login feature.

It’s all good work. Thanks for letting me try it out.

Once a user has clicked the magic link, they should stay logged in for six months, unless you’ve changed the default cookie expiration or unless they’re running some setup that wipes cookies sooner. If that isn’t happening for you, then something may be wrong with your config (preventing the cookie from getting set correctly), or you have some privacy plugin clearing cookies, or you are browsing in incognito mode maybe?

This is a community support forum, so the folks responding to you are unpaid volunteers. We have awesome folks with tons of deep knowledge of Ghost and self-hosting, but as Mark said, it’s hard to support a stack one doesn’t actively use.

2 Likes