AWS EC2 instance in VPN uses private IP for "view post"

I’ve installed Ghost 3.0.2 in AWS EC2 using the latest Bitnami AMI. Everything is good configured URL with ghost config URL, got SSL up with Bitnami cert tool, etc. I am using a VPN and the instance has an elastic IP as public IP and a private IP, 10.0.x.y.

The problem is that ghost uses private IP of the instance, 10.0.x.y, when posting, “view post” wants to open http:/10.0.x.y/post-name. This fails since the public IP is the elastic IP assigned to the instance.

I spent some time poking around apache2 directory and ghost one and don’t see the private IP hardcoded anywhere. How does ghost determine the URL for “view post” link after publishing, and how can it be fixed? Same is with the View site from admin, shows nothing. It was also added in the navigation URLs in Design but I edited those.

The blog is visible on public IP and editing works. So the private IP is getting some use somewhere. I see localhost and used in config.production.json for talking to node. ifconfig is showing the private IP of course. There’s an alias updateip pointing to bnconfig on Birnami, which was renamed bnconfig.disabled but I renamed it back. So where is the private IP found and used?

It’s probably set in the config.production.json file in your installation directory. You can run ghost config get url to check :slight_smile:

It’s not that URL. That I set to the Public blog URL that corresponds to the Elastic IP, the public IP of the instance. Something in ghost is finding and using the box’s own IP. I wonder if that’s Apache, Node, or what…

FWIW, all of Ghost’s URLs are resolved using the config.url, so I would check that it’s being used properly. If you go to https://{URL}/ghost/api/v2/admin/site/, it will show what Ghost is using

Thanks Vikas – it is indeed showing the wrong, private IP. Now how do I change it?

Do you have any other config files in the installation dir? It might be using a different config file. If that’s not the case, you should check the service that runs Ghost, the setting might be overwritten by an env variable

Well this is my question as a newbie, what are the exact locations of configuration files in the order they are loaded? I am using the Bitnami Ghost AMI from AWS Marketplace, running Ghost 3.0.2. I see config.production.json in htdocs root that I made show the right url via ghost config url https://. I have a feeling the Node code is checking ifconfig and setting the IP. I grepped the codebase for networkInterfaces and found cors.js iterating through them and composing a list with ‘localhost’. I am not a JavaScript programmer and would rather hear it from the horse’s mouth where I should hack it if needed…

So the big problem for me is I don’t know how bitnami does Ghost deployments. Does bitnami tell you how to use the Ghost CLI? I’m guessing no, but if they do, it would make life a lot easier. Are you looking at /opt/bitnami/apps/ghost/htdocs/config.production.json?

Configuration order (don’t quote me exactly on this :slight_smile:)

After updating your configuration, are you restarting the instance?

Interesting situation.