Overview
This the official guide for self-hosting Ghost using our recommended stack of Ubuntu 22.04 or 24.04. If you’re comfortable installing, maintaining and updating your own software, this is the place for you. By the end of this guide you’ll have a fully configured Ghost install running in production using MySQL. This install is not suitable for local use or contributing to core.Social Web and Web Analytics
This guide uses our tried-and-tested Ghost-CLI tool to install and configure Ghost. Ghost-CLI installs have support for the social web features via the Ghost(Pro) hosted ActivityPub service and are not compatible with web analytics. To self-host web analytics or fully self-host the ActivityPub service, you will need to try the new docker compose install method.Prerequisites
The officially recommended production installation requires the following stack:- Ubuntu 22.04 or Ubuntu 24.04
- NGINX (minimum of 1.9.5 for SSL)
- A supported version of Node.js
- MySQL 8
- Systemd
- A server with at least 1GB memory
- A registered domain name
Server Setup
This part of the guide will ensure all prerequisites are met for installing the Ghost-CLI.Create a new user
Open up your terminal and login to your new server as the root user:Note: Using the user name
ghost
causes conflicts with the Ghost-CLI, so it’s important to use an alternative name.Update packages
Ensure package lists and installed packages are up to date.Install NGINX
Ghost uses an NGINX server and the SSL configuration requires NGINX 1.9.5 or higher.ufw
was activated, the firewall allows HTTP and HTTPS connections. Open Firewall:
Install MySQL
Next, you’ll need to install MySQL to be used as the production database.Install Node.js
You will need to have a supported version of Node installed system-wide in the manner described below. If you have a different setup, you may encounter problems.Install Ghost-CLI
Ghost-CLI is a commandline tool to help you get Ghost installed and configured for use, quickly and easily. The npm module can be installed withnpm
or yarn
.
ghost help
to see a list of available commands.
Install Ghost
Once your server is correctly setup andghost-cli
is installed, you can install Ghost itself. The following steps are the recommended setup. If you need more fine-grained control, the CLI has flags and options that allow you to break down and customise the install steps.
Create a directory
Ghost must be installed in its own directory, with a proper owner and permissions.Run the install process
Now we install Ghost with one final command.Install questions
During install, the CLI will ask a number of questions to configure your site.Blog URL
Enter the exact URL your publication will be available at and include the protocol for HTTP or HTTPS. For example,https://example.com
. If you use HTTPS, Ghost-CLI will offer to set up SSL for you. Using IP addresses will cause errors.
MySQL hostname
This determines where your MySQL database can be accessed from. When MySQL is installed on the same server, uselocalhost
(press Enter
to use the default value). If MySQL is installed on another server, enter the name manually.
MySQL username / password
If you already have an existing MySQL database, enter the the username. Otherwise, enterroot
. Then supply the password for your user.
Ghost database name
Enter the name of your database. It will be automatically set up for you, unless you’re using a non-root MySQL user/pass. In that case the database must already exist and have the correct permissions.Set up a ghost MySQL user? (Recommended)
If you provided your root MySQL user, Ghost-CLI can create a custom MySQL user that can only access/edit your new Ghost database and nothing else.Set up NGINX? (Recommended)
Sets NGINX up automatically enabling your site to be viewed by the outside world. Setting up NGINX manually is possible, but why would you choose a hard life?Set up SSL? (Recommended)
If you used anhttps
Blog URL and have already pointed your domain to the right place, Ghost-CLI can automatically set up SSL for you using Let’s Encrypt. Alternatively you do this later by running ghost setup ssl
at any time.
SSL certification setup requires an email address so that you can be kept informed if there is any issue with your certificate, including during renewal.
Set up systemd? (Recommended)
systemd
is the recommended process manager tool to keep Ghost running smoothly. We recommend choosing yes
but it’s possible to set up your own process management.
Start Ghost?
Choosingyes
runs Ghost, and makes your site work.
Access and secure your site
Your Ghost site is now live! To set up your admin account, go tohttps://example.com/ghost
. When you get there, you’ll be prompted to create your account as the site owner.
Future maintenance
Once Ghost is properly set up it’s important to keep it properly maintained and up to date. Fortunately, this is relatively easy to do using Ghost-CLI. Runghost help
for a list of available commands, or explore the full Ghost-CLI documentation.
What to do if the install fails
If an install goes horribly wrong, useghost uninstall
to remove it and try again. This is preferable to deleting the folder to ensure no artifacts are left behind.
If an install is interrupted or the connection lost, use ghost setup
to restart the configuration process.
For troubleshooting and errors, use the site search and FAQ section to find information about common error messages.