> ## Content Index
> Fetch the complete content index at: https://andowson.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Ghost安裝
- URL: https://andowson.com/install-self-hosted-ghost-on-debian13/
- Published: 2026-06-24T16:51:21.000Z
- Updated: 2026-10-01T13:29:03.000Z
- Author: Andowson Chang

在Linode上安裝Self-hosted Ghost，作業系統是Debian 13

# 更新系統

sudo apt update  
sudo apt upgrade -y

# 安裝 nginx

sudo apt install nginx -y

# 防火牆

sudo ufw allow 'Nginx Full'  
sudo ufw reload

# 安裝 Node.js 22

sudo apt install -y ca-certificates curl gnupg

sudo mkdir -p /etc/apt/keyrings

curl -fsSL [https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key](https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key?ref=andowson.com) |  
sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

NODE\_MAJOR=22

echo "deb \[signed-by=/etc/apt/keyrings/nodesource.gpg\]  
[https://deb.nodesource.com/node\_$NODE\_MAJOR.x](https://deb.nodesource.com/node%5F$NODE%5FMAJOR.x?ref=andowson.com) nodistro main" |  
sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt update  
sudo apt install nodejs -y

# 安裝 Ghost CLI

sudo npm install -g ghost-cli@latest

# 安裝 MySQL

sudo apt install mysql-server -y

# 安裝 MariaDB(如果無法安裝MySQL時)

sudo apt install mariadb-server -y

# 建立資料庫

sudo mysql

CREATE DATABASE ghost\_prod;

CREATE USER 'ghostuser'@'localhost'  
IDENTIFIED BY '你的強密碼';

GRANT ALL PRIVILEGES  
ON ghost\_prod.\*  
TO 'ghostuser'@'localhost';

FLUSH PRIVILEGES;  
EXIT;

# 建立網站目錄

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

cd /var/www/ghost

ghost install

# Nginx 反向代理配置

```
server {
    listen 80;
    listen [::]:80;	
    server_name andowson.com blog.andowson.com;
	
    location ^~ /.well-known/acme-challenge/ {
        root /var/www/html;
        default_type "text/plain";
        try_files $uri =404;
    }
    
    # favicon bypass
    location = /favicon.ico {
        access_log off;
        log_not_found off;
    }
	
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:2368;
    }
}
```

[Ghost: Simplifying Self-HostingGhost is a powerful, open-source platform designed for creating and managing professional-grade websites, blogs, and publications. Its focus on simplicity, speed, and elegant design makes it an excellent choice for developers, system administrators, and tech-savvy users who value complete control over their data and infrastructure. In this![](https://andowson.com/content/images/icon/favicon-512x512-0864eea5e1cc5f73-b0fddd1c-ae8c-4f4e-ab77-044e53953fd6.png)Selfhosted NinjaEditorial Staff![](https://andowson.com/content/images/thumbnail/Ghost_feature-ebedc8c3ac4e39cd-33d52685-8269-417d-89d4-6eed45232d84.webp)](https://www.selfhostedninja.com/ghost-simplifying-self-hosting/?ref=andowson.com)

參考網站