@muriel.schmidt
To publish a Ghost blog on Google Cloud, you can follow the steps below:
- Set up a Google Cloud account and create a new project.
- Open the Google Cloud Console and go to the Cloud Shell.
- 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
|
- Install the Google Cloud command-line tool (Cloud SDK) by following the instructions provided by Google.
- 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.
- SSH into the instance by running the following command in the Cloud Shell:
1
|
gcloud compute ssh ghost
|
- 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
|
- 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
|
- Install and configure Ghost by running the following command:
Follow the prompts and provide the necessary details, such as your URL, database information, and email address.
- 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.
- 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
|
- Update your DNS settings to point your domain or subdomain to the IP address of your Google Cloud instance.
- 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.