You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Building websites
Setting up a Ghost blog website
Copy page
Download PDF
Setting up a Ghost blog website
Ghost is an outstanding open-source blog website developed with Node.js. It uses MySQL, SQLite, or PostgreSQL to store data. This topic describes how to set up a Ghost blog website for a production environment on the Linux operating system.​
Feature comparison​
Compared to Wordpress, Ghost offers advantages such as instant preview, simplicity, and ease of use:​
  • Architecturally, Ghost is developed by using Node.js, enabling higher concurrency.​
  • In terms of design, Ghost features a more streamlined interface, native Markdown support, and a writing-focused environment that minimizes distractions.​
  • Ghost supports multiple capabilities such as online preview and online writing, facilitating seamless content creation anytime, anywhere.​
Software versions​
  • Operating system: In the example provided in this topic, Ubuntu 18.04 is used.​
  • Nginx: A high-performance, lightweight web server that supports HTTP and reverse proxy. In the example provided in this topic, Nginx 1.14.0 is used.​
  • MySQL: A database management system. In the example provided in this topic, MySQL 14.14 is used.​
  • Node.js: A server-side scripting language embedded in HTML documents. In the example provided in this topic, Node.js 14.18.1 is used.​
  • Ghost: In the example provided in this topic, Ghost 4.24.0 is used.​
Step 1: Create a user​
The official Ghost website recommends that you do not perform operations directly as the root user. Before you set up a Ghost blog website, create a user.​
  1. Remotely connect to and log in to the ECS instance. For more information, see Logging in to Linux instances.​
  1. Execute the following command to create a user.​
  • Do not use ghost as a username. Otherwise, conflicts with Ghost-CLI may arise. In the example provided in this topic, ghostuser is used as the username.​
  • ​
    adduser ghostuser​
    ​
  • The following output is displayed. You need to specify the password and other information for ghostuser. If you do not want to specify other information, you can press the Enter key to skip the configuration.​
  • ​
    Enter new UNIX password: ​
    Retype new UNIX password: ​
    passwd: password updated successfully​
    Changing the user information for sxm​
    Enter the new value, or press ENTER for the default​
    Full Name []: ​
    Room Number []: ​
    Work Phone []: ​
    Home Phone []: ​
    Other []: ​
    Is the information correct? [Y/n]​
    ​
  1. Execute the following command to add user permissions.​
  • ​
    usermod -aG sudo ghostuser​
    ​
  1. Execute the following command to switch to the ghostuser user.​
  • ​
    su - ghostuser​
    ​
  • If the following output is displayed, you are switched to the ghostuser user.​
  • ​image​​
Step 2: Install Nginx​
  1. Execute the following command to update the software package.​
  • ​
    sudo apt-get update​
    sudo apt-get upgrade -y​
    ​
  1. Execute the following command to install Nginx.​
  • ​
    sudo apt-get install -y nginx​
    ​
  1. Execute the following command to view the Nginx version.​
  • ​
    nginx -v​
    ​
  • If the following output is displayed, the installation is successful.​
  • ​
    nginx version: nginx/1.14.0 (Ubuntu)​
    ​
  1. In the local browser, enter http://<ECS instance EIP>/ to access Nginx.​
  • If the following output is displayed, Nginx is set up successfully.​
  • ​image​​
Step 3: Install Node.js​
  1. Execute the following commands in sequence to install Node.js.​
  • ​
    apt install curl​
    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash ​
    sudo apt-get install -y nodejs​
    ​
  1. Execute the following command to view the Node.js version.​
  • ​
    node -v​
    ​
  • If the following output is displayed, Node.js is set up successfully.​
  • ​
    v14.18.1​
    ​
Step 4: Install MySQL​
  1. Execute the following command to install MySQL.​
  • ​
    sudo apt-get install -y mysql-server​
    ​
  1. Execute the following command to connect to MySQL.​
  • ​
    sudo mysql​
    ​
  1. Execute the following command to create the database used by Ghost. In the example provided in this topic, ghostdata is created.​
  • ​
    CREATE DATABASE ghostdata;​
    ​
  1. Execute the following command to specify the password for the root account.​
  • ​
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Input the root account Password';​
    ​
  1. Execute the following command to exit MySQL.​
  • ​
    \q​
    ​
  1. Execute the following command to view the MySQL version.​
  • ​
    mysql -V​
    ​
  • If the following output is displayed, MySQL is set up successfully.​
  • ​
    mysql Ver 14.14 Distrib 5.7.36, for Linux (x86_64) using EditLine wrapper​
    ​
Step 5: Install and configure Ghost​
  1. Execute the following command to install the Ghost-CLI tool.​
  • ​
    sudo npm install ghost-cli@latest -g​
    ​
  1. Execute the following command to create a folder for installing Ghost.​
  • ​
    sudo mkdir -p /var/www/ghost​
    ​
  1. Execute the following command to configure permissions for the ghostuser user.​
  • ​
    sudo chown ghostuser:ghostuser /var/www/ghost​
    ​
  1. Execute the following command to enter the Ghost folder.​
  • ​
    cd /var/www/ghost​
    ​
  1. Execute the following command to install Ghost by using Ghost-CLI.​
  • ​
    ghost install​
    ​
  • The following output is displayed. Complete the configuration in sequence.​
  • You can perform simple configurations based on your business requirements. If you want to make changes later, execute the vi config.production.json command to open the configuration file and make the necessary changes.​
  • ​
    ? Enter your blog URL: http://www.****.com #The domain name of the Ghost blog.​
    ? Enter your MySQL hostname: localhost #The endpoint of the database. In this example, the database resides on the instance. Therefore, type `localhost`.​
    ? Enter your MySQL username: root #The username of the database. Input root.​
    ? Enter your MySQL password: [hidden] #The password of the database. Type the password of the root user.​
    ? Enter your Ghost database name: ghostdata #The database used by Ghost. Type the name of the database created in step 4.​
    ​
  • Follow the onscreen instructions to perform operations.​
Step 6: Visit the Ghost blog website​
Enter the Ghost domain name in your local browser to access the Ghost blog website.​
Step 7 (Optional): Enable HTTPS for the website​
When a user accesses your website over the HTTP protocol, the browser warns the user that the connection is not secure. We recommend that you enable HTTPS secure communication for your website. This ensures encrypted data transmission between users and your website, effectively defending against network hijacking, information leakage, and other threats.​
To enable HTTPS, you need to deploy an SSL certificate on your website. You can apply for a free SSL certificate in the Volcano Engine Certificate Center. For more information, see Applying for free certificate and Downloading and installing certificate.​
Last updated: 2026.06.18 19:52:58