Ghost Blog 安装记录


标题是 这个

安装Node.js 略
安装MySQL 略
安装Nginx 略
安装 Ghost Blog
  • 下载 略
  • 解压,换路径略
  • 配置 如下

var path = require('path'),
    config;

config = {
    production: {
        url: 'http://abbycin.tk/freedom',
        mail: {},

        database: {
            client: 'mysql',
            connection: {
                host     : 'localhost',
                user     : 'username',
                password : 'password',
                database : 'database',
                charset  : 'utf8'
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2368'
        },

        storage: {
            provider: 'local-file-store'
        }

    },

    development: {
        url: 'http://abbycin.tk/freedom',

        database: {
            client: 'mysql',
            connection: {
                host     : 'localhost',
                user     : 'username',
                password : 'password',
                database : 'database',
                charset  : 'utf8'
            },

            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2368'
        },

        paths: {
            contentPath: path.join(__dirname, '/content/')
        }
    }
};
  • 配置nginx
server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /srv/site;
        index index.html index.htm;

        server_name localhost;

        location / {
                try_files $uri.html /index.html $uri $uri/ =404;
        }

        location ~* /freedom {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $http_host;
                proxy_pass      http://127.0.0.1:2368;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }
}

  • 安装 forever 写个脚本放到/bin/
#!/bin/bash

start()
{
        cd $GHOST
        NODE_ENV=production forever start index.js
}

stop()
{
        cd $GHOST
        forever stop index.js
}

status()
{
        forever status
}

restart()
{
        stop
        start
}

main()
{
        GHOST=/srv/site/freedom

        case $1 in
                "start")
                        start;;
                "stop")
                        stop;;
                "restart")
                        restart;;
                "status")
                        status;;
                *)
                        echo -e "\e[35m$0 [start|stop|restart|status]"
        esac
}



if [ $# -ne 1 ]
then
        echo -e "\e[35m$0 [start|stop|restart|status]"
else
        main $1
fi

  • 最后,后台是here

刚开始使用,探索中...



转载请注明:Serenity » Ghost Blog 安装记录