How to Self-Host Ghost on Hetzner (2026 Guide)
Ghost is a powerful open-source platform for publishing online, particularly for blogs and professional websites. Self-hosting Ghost on a VPS like Hetzner allows you greater control over your application and hosting environment. In this guide, we will walk you through the process of setting up Ghost on a Hetzner VPS.
Why Choose Hetzner?
Before we dive into the installation, letโs briefly look at why Hetzner could be the right choice for your Ghost hosting needs:
| Provider | Price (EUR/mo) | RAM | Disk Space | Region |
|---|---|---|---|---|
| Hetzner Cloud | 4.15 | 2GB | 20GB | Germany, Finland |
| Contabo VPS | 5.99 | 4GB | 400GB | Germany |
| DigitalOcean | 6.00 | 1GB | 25GB | Global |
| Vultr | 6.00 | 1GB | 25GB | Global |
| Linode | 5.00 | 2GB | 50GB | Global |
As seen in the table, Hetzner offers competitive pricing and good specifications, making it a cost-effective option for self-hosted applications.
Getting Started
Prerequisites
-
Hetzner VPS: Sign up for a Hetzner account and create a VPS instance. The 4.15 EUR/month plan should suffice for basic usage.
-
Domain: Purchase a domain name if you plan to serve your Ghost blog under a custom domain.
-
Basic Knowledge: Familiarity with Linux command line, SSH, and Git is recommended.
Step 1: Create Your VPS
- Log in to Hetzner Cloud Console.
- Create a new project and select a suitable VPS configuration.
- Choose an operating system (Ubuntu 20.04 or 22.04 LTS) for better compatibility with Ghost.
- Note down your SSH access credentials.
Step 2: Access Your VPS
Using your terminal, connect to your VPS via SSH.
ssh root@your_vps_ip
Step 3: Update and Install Dependencies
Before installing Ghost, update your system and install necessary packages.
sudo apt update && sudo apt upgrade -y
sudo apt install nginx mysql-server curl -y
Ghost requires Node.js and npm, so weโll also install that.
Install Node.js
Add NodeSource repository and install Node.js (version 16.x recommended for Ghost).
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install nodejs -y
Install Ghost CLI
Now, install Ghost CLI globally.
sudo npm install -g ghost-cli
Step 4: Configure MySQL
Now, letโs set up MySQL for Ghost.
-
Log into MySQL:
sudo mysql -u root -p -
Create a database and user:
CREATE DATABASE ghostdb; CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON ghostdb.* TO 'ghostuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 5: Install Ghost
-
Create a directory for Ghost and navigate into it:
mkdir -p /var/www/ghost cd /var/www/ghost -
Install Ghost:
ghost install
During the installation, you will be prompted to provide your domain name, database credentials, and a few other settings. Follow the prompts carefully.
Step 6: Configure Nginx
After Ghost installation, you need to adjust Nginx settings to serve your Ghost blog.
-
Create an Nginx server block:
sudo nano /etc/nginx/sites-available/ghost -
Add the following configuration:
server { listen 80; server_name your_domain.com; location / { proxy_pass http://localhost:2368; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } -
Enable the configuration:
sudo ln -s /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx
Step 7: Access Your Ghost Blog
Open your web browser and navigate to http://your_domain.com. Follow the on-screen instructions to complete the Ghost setup.
FAQs
How do I secure my Ghost instance?
To secure your Ghost blog, consider enabling SSL with Letโs Encrypt. This requires additional installations, but Ghost CLI can automatically handle this for you during the installation process. Follow the prompts during the ghost install command to set up your SSL configuration.
Can I scale my Hetzner VPS as traffic increases?
Yes, Hetzner allows you to upgrade your serverโs resources easily. When you notice increased traffic, you can navigate to the Hetzner Cloud Console and scale your VPS plan to accommodate more memory or CPU without downtime. Check this full VPS comparison for information on scaling options.
What if I encounter issues during installation?
If you run into issues while installing Ghost, consult the Ghost documentation for troubleshooting tips. It provides detailed guidance on common installation issues and fixes. Additionally, the community on r/selfhosted is a valuable resource for finding solutions. Consider searching or posting your specific issue there for assistance.
By following this guide, you should have a fully functional Ghost blog running on a Hetzner VPS. Happy blogging!