When you have the need to change the URL of your self-hosted Ghost website, it might initially appear daunting, but fear not! While there are several steps to the process, each one is relatively straightforward. In this post, we'll go through each step in detail to help you navigate through the process smoothly.
Step 1: Pointing Your New Domain to Your Server
The first order of business is to redirect your new domain to your server. This is achieved by establishing an 'A' record within your domain provider, which then points directly to your server's IP address. The 'A' record essentially guides the DNS to your website's actual physical location (your server).
DNS Provider > A Record > Point to Server's IP Address
Step 2: Modifying Your Ghost Site's Config File
Following this, you'll need to log into your server and modify the URL of your Ghost site. To do this, you'll need to change directories ('cd') into the specific folder where your Ghost files are housed. If you're using Digital Ocean as a server, for example, you would find this in the /var/www/ghost
folder.
Here's the command you'd use:
cd /var/www/ghost
Then, you'll run the Ghost configuration command, replacing https://yournewdomain.com
with your new domain:
ghost config url https://yournewdomain.com
Note: Be sure to include the protocol (https
, in this case) when setting the URL.
Step 3: Setting up Nginx
Next, you will need to set up Nginx, a web server software. This involves executing the ghost setup nginx
command, which creates server-level files required for serving your Ghost site on the newly defined domain. You can do this by running:
ghost setup nginx
Step 4: Generating a New SSL Certificate
The fourth step is to generate a new SSL (Secure Sockets Layer) certificate, which ensures secure connections from a web server to a browser. Run the ghost setup ssl
command, which will guide you through the process of generating a free SSL certificate from Let's Encrypt. You'll need to provide an email address during the installation:
ghost setup ssl
Step 5: Restarting Ghost
Lastly, restart your Ghost software with ghost restart
. This effectively refreshes all the links across your website, making sure the changes apply throughout.
eghost restart
And there you have it, five straightforward steps to update the URL of your self-hosted Ghost site. This guide should ease the process and make your task less daunting. Remember to be careful while making these changes, and you should have your Ghost site running smoothly with its new URL in no time.