Replace IP with domain name in URL of Bitnami Ghost Deployment

Replace IP with domain name in URL of Bitnami Ghost Deployment

After getting my blog running using Google Cloud Platform cloud launcher option with the Bitnami Ghost prebuilt image I noticed the URL in my browser shows the IP address of the VM instead of showing the domain name I expected to see. After some research I found this is a configuration parameter in the Ghost config file. Since this is a Bitnami deployment the config file is located here:

sudo nano /opt/bitnami/apps/ghost/htdocs/config.js

In the config you will find the IP address of your Google Cloud Platform instance in the config object under each type of deployment production, development, and testing.

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://1.2.3.4:80',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    },

Change the url key in the config object to reflect your domain name instead of the IP address for your GCP VM instance.

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://braytonstafford.com',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    },

After changing the config file to reflect your domain name just run the following command to reload the configuration:

sudo /opt/bitnami/ctlscript.sh restart

After the configuration is reloaded Ghost will recognize your domain as the base URL!