Oliver Servín

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:

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

to:

location / {
proxy_pass http://127.0.0.1:2368;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection ‘upgrade’;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

Add a MySQL database

Create a new database for Ghost.

Install Ghost

Connect to the server via SSH.

ssh [email protected]_ADDRESS

Install Ghost CLI.

sudo npm i -g ghost-cli

Remove your existing ghost directory.

cd oliver.mx
sudo rm -rf ghost

Make a ghost directory and install Ghost.

mkdir ghost && cd ghost
ghost install

The installation process looks like this:

Enter your blog URL: https://oliver.mx
Enter your MySQL hostname: 127.0.0.1
Enter your MySQL username: forge
Enter your MySQL password: [Forge created Database password]
Enter your Ghost database name: ghostblog
 
# Answering no will skip the SSL set up as well
Do you wish to set up Nginx? n
 
Do you wish to set up "ghost" mysql user? n
 
Do you wish to set up Systemd? Y
 
Do you want to start Ghost? Y

Congrats! Your new Ghost blog is alive.


Interact with API result values as object properties in Laravel


Get relative path with `route()` in Laravel


Chokidar file watcher to auto-run Pest tests


Chaining "Where" conditions using dynamic methods


Model factories with relationships by using magic methods


Show amount to pay in next billing cycle with Laravel Cashier (Stripe)


Tax calculation with Laravel Cashier for Stripe


How to keep in sync your customers details with Stripe in Laravel


Handle Paddle's marketing consent with Laravel


Custom styling the pay button with Laravel Cashier Paddle


Embed Paddle's checkout widget with Laravel Cashier


Weekly auto-reset a Laravel demo app


Remove the personal_access_tokens table on a fresh Laravel App


Deploy Umami analytics with Launcher


Fix Laravel storage:link using Launcher


Launcher: first impressions


Integrating Tiptap in a Laravel-Livewire project


Probando Google Ads con RadioCúbito(Design)


How to run a Ghost blog on Laravel Forge