Change domain name in ghost

Ghost Aug 15, 2021

Let us say you just started and you just hosted your first ghost server. You used a temporary domain name just to test it out. Now you figured everything out and you want to change the domain name.

1. Changing the domain name

I will start from the beginning.

  1. Connect to your server
    ssh root@<yourip>
  2. Navigate to your ghost folder
    cd /var/www/<yourwebsite>

Tip: When navigating through the folders and files type one letter or multiple and hit tab the terminal will paste the first folder or file that starts with the letter combination.

In case you followed the ghost guide, you probably created a new user, so your access will be denied. sudo su -- <youruser> and repeat the beginning of step 2.

  1. Check for the config.production.json
    ls It will show you all the folders and files. If you see the config.production.json, then nano config.production.json

  2. Edit the config.production.json

At the top of the config, you will see the following:


Navigate with your arrow keys to the URL and replace it with the new URL.

  • Press ctrl + S to save
  • Press ctrl + X to close
  1. Now we need to integrate the new URL
  • ghost setup nginx
  • ghost setup ssl "Only if you want an SSL certificate"
  • ghost restart

2. Conclusion

Changing the domain name in Ghost is a simple process. Access the config.production.json file, replace the old URL with the new one, and integrate the changes by configuring NGINX, setting up SSL (optional), and restarting Ghost. With the domain name updated, your website will be ready to go under the new URL.