Ghost Upgrade on New VPS

VPS 供应商搞特价,于是就买了新的KVM架构的VPS,顺便也把Ghost升级了。


Upload SSH key

拿到VPS第一件事,就是上传SSH Key,以便免密登陆。

ssh-copy-id username@remote_host

Ghost Installation

步骤可以参考: Install & Setup (production)

NIN: 遗憾的是,ghost-cli 仅支持Ubuntu.

✔ Finishing install process
? Enter your blog URL: https://blog.ninoishere.com
? Enter your MySQL hostname: localhost
? Enter your MySQL username: root          // NIN: 需要root账号,以便安装过程中create new user.
? Enter your MySQL password: [hidden]
? Enter your Ghost database name: ghost_production_ghost
✔ Configuring Ghost
✔ Setting up instance
Running sudo command: chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user
? Do you wish to set up Nginx? Yes
✔ Creating nginx config file at /var/www/ghost/system/files/blog.ninoishere.com.conf
Running sudo command: ln -sf /var/www/ghost/system/files/blog.ninoishere.com.conf /etc/nginx/sites-available/blog.ninoishere.com.conf
Running sudo command: ln -sf /etc/nginx/sites-available/blog.ninoishere.com.conf /etc/nginx/sites-enabled/blog.ninoishere.com.conf
Running sudo command: service nginx restart
✔ Setting up Nginx
? Do you wish to set up SSL? Yes
? Enter your email (used for Let's Encrypt notifications) [REDACTED]
✔ Creating ssl security parameters file at /var/www/ghost/system/files/ssl-params.conf
✔ Creating ssl config file at /var/www/ghost/system/files/blog.ninoishere.com-ssl.conf
Running sudo command: ln -sf /var/www/ghost/system/files/blog.ninoishere.com-ssl.conf /etc/nginx/sites-available/blog.ninoishere.com-ssl.conf
Running sudo command: ln -sf /etc/nginx/sites-available/blog.ninoishere.com-ssl.conf /etc/nginx/sites-enabled/blog.ninoishere.com-ssl.conf
Running sudo command: service nginx restart
✔ Setting up SSL
? Do you wish to set up "ghost" mysql user? Yes       // NIN: 创建db user - ghost
✔ Setting up "ghost" mysql user
? Do you wish to set up Systemd? Yes
✔ Creating systemd service file at /var/www/ghost/system/files/ghost_blog-ninoishere-com.service
Running sudo command: ln -sf /var/www/ghost/system/files/ghost_blog-ninoishere-com.service /lib/systemd/system/ghost_blog-ninoishere-com.service
Running sudo command: systemctl daemon-reload
✔ Setting up Systemd
✔ Running database migrations
? Do you want to start Ghost? Yes
✔ Validating config
Running sudo command: systemctl start ghost_blog-ninoishere-com
✔ Starting Ghost
Running sudo command: systemctl enable ghost_blog-ninoishere-com --quiet
✔ Starting Ghost
You can access your blog at https://blog.ninoishere.com

Ghost uses direct mail by default
To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config

Post-Installation

Email

NIN: 请先停止blog,再修改config。否则,会出现话port被占用的情况,无法重启ghost。

假如 Run ghost start 时,投诉port被占用

Message: Port '2368' is in use.
Configuration Key(s): server.port
Current Value(s): 2368

查看开启的services

$ systemctl | grep running
$ systemctl stop  ghost_blog-ninoishere-com
// Modify config
$ ghost start
$ systemctl start  ghost_blog-ninoishere-com
// Config sample
{
  "url": "https://blog.ninoishere.com",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "ghost-592",
      "password": "[REDACTED]",
      "database": "[REDACTED]",
      "charset": "utf8"
    }
  },
  "mail": {
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "auth": {
        "user": "[REDACTED]",
        "pass": "[REDACTED]"
      }
    }
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  }
}

Google Analytics

之前懒惰没有加入GA,新Blog就加进去吧,有空看看也好,不过估计也没多少数据。

Ref: Google Analytics – Ghost

Show Comments