How to publish Ghost on Google Cloud?

by muriel.schmidt , in category: Third Party Scripts , 6 months ago

How to publish Ghost on Google Cloud?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by orpha , 6 months ago

@muriel.schmidt 

To publish a Ghost blog on Google Cloud, you can follow the steps below:

  1. Set up a Google Cloud account and create a new project.
  2. Open the Google Cloud Console and go to the Cloud Shell.
  3. Enable the necessary APIs by running the following commands in the Cloud Shell:
1
2
gcloud services enable compute.googleapis.com
gcloud services enable container.googleapis.com


  1. Install the Google Cloud command-line tool (Cloud SDK) by following the instructions provided by Google.
  2. Create a new Google Compute Engine instance by running the following command in the Cloud Shell:
1
gcloud compute instances create ghost --image-family=ubuntu-1804-lts --image-project=ubuntu-os-cloud --tags=http-server,https-server


Make sure to replace "ghost" with your preferred instance name.

  1. SSH into the instance by running the following command in the Cloud Shell:
1
gcloud compute ssh ghost


  1. Install Node.js and Ghost by running the following commands inside the instance:
1
2
3
sudo apt-get update
sudo apt-get install -y nodejs npm
sudo npm install -g ghost-cli


  1. Create a new directory for your Ghost blog and navigate into it by running the following commands:
1
2
3
sudo mkdir -p /var/www/ghost
sudo chown $USER:$USER /var/www/ghost
cd /var/www/ghost


  1. Install and configure Ghost by running the following command:
1
ghost install


Follow the prompts and provide the necessary details, such as your URL, database information, and email address.

  1. Set up a reverse proxy to expose the Ghost blog by installing and configuring Nginx. Run the following commands:
1
2
3
sudo apt-get install -y nginx
sudo rm /etc/nginx/sites-available/default
sudo nano /etc/nginx/sites-available/ghost


Inside the "ghost" file, paste the following configuration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
    }
}


Replace "your-domain.com" with your actual domain or IP address.

  1. Enable the Ghost site and restart Nginx by running the following commands:
1
2
sudo ln -s /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/ghost
sudo systemctl restart nginx


  1. Update your DNS settings to point your domain or subdomain to the IP address of your Google Cloud instance.
  2. You should now be able to access your Ghost blog by visiting your domain or subdomain in a web browser.


Note: Make sure to configure SSL/TLS for HTTPS support by obtaining an SSL certificate and configuring Nginx accordingly.