CentOS7下安裝Ghost1.22博客

CentOS7下安裝Ghost1.22博客

Chost博客已經更新到了1.22版本,下面介紹一下如何在CentOS7中安裝.
這裏採用Ghost+Mysql+Nginx的方式。node

  1. Mysql安裝配置mysql

    安裝mysqlnginx

    rpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm 
    yum -y install mysql-server mysql
    systemctl start mysqld.service

    配置mysqlgit

    mysql 
    mysql> create database ghost;
    mysql> grant all on ghost.* to 'ghost'@localhost identified by 'ghost';
    mysql> flush privileges;

    這時執行mysql -ughost -pghost,就能夠以ghost用戶,ghost密碼登陸管理ghost數據庫.sql

  2. node安裝數據庫

    安裝node6npm

    curl -sL https://rpm.nodesource.com/setup_6.x | bash -  
    yum install nodejs

    驗證json

    node -v
  3. 安裝ghost-clibash

    安裝ghost-clicurl

    npm i -g ghost-cli

    最好升級一下最新的ghost-cli

    yum install -y git

    配置加速

    npm config set registry https://registry.npm.taobao.org

    安裝過程

    npm i -g ghost-cli to update
  4. 配置ghost用戶

    adduser ghost
    mkdir /var/www/ghost
    chown ghost /var/www/ghost
  5. 配置sudo權限

    groupadd sudo
    chown -R ghost:sudo /home/ghost/
    chmod 775 /home/ghost/
    usermod -aG sudo ghost
  6. 切換用戶安裝

    su ghost
    cd /var/www/ghost
    ghost install local --db mysql

    根據提示輸入相關信息,便可

    [ghost@ming ghost]$ ghost install local --db mysql
    ✔ Checking system Node.js version
    ✔ Checking current folder permissions
    ✔ Checking memory availability
    ✔ Checking for latest Ghost version
    ✔ Setting up install directory
    ☱ Downloading and installing Ghost v1.22.3 > Installing dependencies > [3/5] Fetching packages...

    等待老是漫長...

    ? Enter your MySQL hostname: localhost
    ? Enter your MySQL username: ghost
    ? Enter your MySQL password: [hidden]
    ? Enter your Ghost database name: ghost
    ✔ Configuring Ghost
    ✔ Setting up instance
    ✔ Running database migrations
    ℹ Ensuring user is not logged in as ghost user [skipped]
    ℹ Checking if logged in user is directory owner [skipped]
    ✔ Checking current folder permissions
    ✔ Validating config
    ✔ Checking memory availability
    ✔ Starting Ghost
    You can access your blog at http://localhost:2368/
    
    Ghost uses direct mail by default
    To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config
  7. 修改配置文件

    查看ghost

    ghost ls

    能夠看到ghost如今是運行在開發模式development下,下面修改成生產模式

    ghost stop
    cp config.development.json config.production.json

    在配置文件裏面修改url,改爲你本身的域名便可

    vi config.production.json
    
    "url": "http://120.27.119.12/"
    
    ghost start便可
  8. nginx 反向代理

    安裝nginx

    yum install -y nginx

    修改配置

    cd /etc/nginx/conf.d/
    vi ghost.conf
    
    server {  
    listen 80;
    server_name 120.27.119.12;
    
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
    }
    }

    啓動nginx

    nginx

    你們能夠訪問關注個人我的博客 遂更記憶 www.suigengjiyi.com

相關文章
相關標籤/搜索