How to run a Ghost blog on Laravel Forge

Since I have a Laravel Forge account to help me manage my server, I wanted to host this Ghost blog in it too, and it's relatively easy.

Create a server on Forge

I'm using a Stardust instance in Scaleway since it keeps my operating costs relatively low. It costs around $2.2/month(€0.0025/hour).

Create a new site with /ghost/current path as Web Directory, and set up a new SSL certificate with LetsEncrypt.

Setup Nginx

Edit the site Nginx configuration.

Replace index index.html index.htm index.php; with index index.js index.html index.htm index.php;

Replace the location block from:

1location ~ \.php$ {
2 fastcgi_split_path_info ^(.+\.php)(/.+)$;
3 fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
4 fastcgi_index index.php;
5 include fastcgi_params;
6}

to:

1location / {
2 proxy_pass http://127.0.0.1:2368;
3 proxy_http_version 1.1;
4 proxy_set_header Upgrade $http_upgrade;
5 proxy_set_header Connection ‘upgrade’;
6 proxy_set_header Host $host;
7 proxy_cache_bypass $http_upgrade;
8}

Add a MySQL database

Create a new database for Ghost.

Install Ghost

Connect to the server via SSH.

1ssh forge@IP_ADDRESS

Install Ghost CLI.

1sudo npm i -g ghost-cli

Remove your existing ghost directory.

1cd oliver.mx
2sudo rm -rf ghost

Make a ghost directory and install Ghost.

1mkdir ghost && cd ghost
2ghost install

The installation process looks like this:

1Enter your blog URL: https://oliver.mx
2Enter your MySQL hostname: 127.0.0.1
3Enter your MySQL username: forge
4Enter your MySQL password: [Forge created Database password]
5Enter your Ghost database name: ghostblog
6 
7# Answering no will skip the SSL set up as well
8Do you wish to set up Nginx? n
9 
10Do you wish to set up "ghost" mysql user? n
11 
12Do you wish to set up Systemd? Y
13 
14Do you want to start Ghost? Y

Congrats! Your new Ghost blog is alive.