Ghost is a popular open-source platform for professional bloggers, offering a simple and modern interface with powerful publishing tools. In this tutorial, we will go through the steps to deploy the Ghost blogging platform with Nginx on Debian 12. Whether you're deploying on a local server or on a VPS server, this guide will help you get your Ghost blog up and running in no time.

Prerequisites

Before you begin, make sure you have the following:

  • A server running Debian 12 (it can be a local machine or a Windows VPS).
  • Root access or a user with sudo privileges.
  • A domain name (optional, but recommended for setting up Nginx).

Step 1: Update Your Server

First, update your package list and all the installed packages to ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

This will ensure that your server is secure and ready for the Ghost installation. Keeping your server updated is especially important for VPS server environments.

Step 2: Install Nginx

Nginx is a popular and efficient web server. To install Nginx, run the following command:

sudo apt install nginx -y

Once installed, start and enable Nginx to run at boot:


sudo systemctl start nginx
sudo systemctl enable nginx
        

You can verify the installation by opening your server's IP address in a browser. If everything is working correctly, you should see the default Nginx page.

Step 3: Install Node.js

Ghost runs on Node.js, so we need to install it. Add the Node.js repository and install the latest version of Node.js:


curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
        

After the installation, verify the Node.js version:

node -v

Ensure that you have Node.js version 18.x or later installed.

Step 4: Install MySQL

Ghost requires a database, and MySQL is a common choice. Install MySQL with the following command:

sudo apt install mysql-server -y

After installation, start and enable the MySQL service:


sudo systemctl start mysql
sudo systemctl enable mysql
        

Run the following script to secure your MySQL installation:

sudo mysql_secure_installation

This will prompt you to configure security settings like the root password, removing anonymous users, and disabling remote root login.

Step 5: Create a MySQL Database for Ghost

Log into the MySQL shell to create a new database and user for Ghost:

sudo mysql -u root -p

Once logged in, run the following commands to create the database and user:


CREATE DATABASE ghost;
CREATE USER 'ghostuser'@'localhost' IDENTIFIED BY 'your-strong-password';
GRANT ALL PRIVILEGES ON ghost.* TO 'ghostuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
        

Replace your-strong-password with a secure password.

Step 6: Install Ghost-CLI

Ghost-CLI is a command-line tool for installing and managing Ghost. Install Ghost-CLI globally by running:

sudo npm install -g ghost-cli@latest

Once installed, create a directory for Ghost:


sudo mkdir -p /var/www/ghost
sudo chown $USER:$USER /var/www/ghost
cd /var/www/ghost
        

Step 7: Install Ghost

Now that Ghost-CLI is installed, we can install Ghost by running the following command in the Ghost directory:

ghost install

During installation, Ghost-CLI will prompt you to enter your domain name, configure SSL (using Let's Encrypt), and set up the MySQL database details.

Step 8: Configure Nginx for Ghost

Ghost-CLI will automatically configure Nginx for you during the installation. If you ever need to manually restart Nginx or check its status, use the following commands:


sudo systemctl restart nginx
sudo systemctl status nginx
        

Step 9: Access Your Ghost Blog

Once the installation is complete, open your browser and navigate to your domain name or server IP address. You should see your Ghost blog running. To access the admin panel, add /ghost to your domain (e.g., http://yourdomain.com/ghost).

Conclusion

Deploying Ghost with Nginx on Debian 12 is a straightforward process. With Nginx as the web server and MySQL as the database, Ghost offers a powerful platform for managing your content. Whether you're running this setup on a local server or a VPS server, you can now enjoy a professional, fast, and modern blogging experience. For reliable VPS hosting, visit WindowsVPS.uk for scalable and secure VPS solutions.

For more tutorials and VPS hosting solutions, visit WindowsVPS.uk.

War diese Antwort hilfreich? 0 Benutzer fanden dies hilfreich (0 Stimmen)