一对一免费咨询: 13913005726 025-66045668

Ghost是一款个人博客系统,它是使用Node.js语言和MySQL数据库开发的,同时支持MySQL、MariaDB、SQLite和PostgreSQL。用户可以在支持Node.js的服务器上使用自己的博客。它是由两位WordPress前工程师开发,特点就是轻 快 高效,并原生支持Markdown语法。

在WordPress变得越来越强大,同时又越来越臃肿的今天,Ghost的出现,无疑为博客系统界带来一股清风。 虽然如此,Ghost目前的使用者还局限于有一定代码基础的Geek,工程师们,它并不完善。如果您想尝试一下Ghost博客的轻便快速,不妨跟随本文来进行一番尝试。

本文使用的环境如下: CentOS 6.6 x86_64纯净系统 。搭建目标如下:

1.nginx 1.9.2 编译SPDY模块 ;

2.node.js v0.12.4 ;

3.MariaDB 10.1.5(YUM快速安装) ;

4.安装并配置Ghost 0.6.3程序 。

更多的有关于博客系统搭建的信息可查看:静态博客程序使用入门

一、编译安装Nginx 1.9.2

1.首先我们去官方网站下载最新的nginx源码:

    cd /usr/local/src

wget http://nginx.org/download/nginx-1.9.2.tar.gz

2.解压nginx源码:

tar xzvf nginx-1.9.2.tar.gz

cd nginx-1.9.2

3.编译openssl(为https准备,不需要请跳过该步骤)

yum update -y && yum install -y ncurses-devel make gcc bc  

cd /usr/local/src

wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz

tar zxvf openssl-1.0.1h.tar.gz

cd openssl-1.0.1h

./config

make

4.建立makefile(此处加入了https(--with-httpsslmodule)与spdy(--with-httpspdymodule)模块,若不需要请去掉)

#安装依赖环境

yum update -y && yum install pcre-devel zlib-devel

#编译nginx

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --with-http_spdy_module --with-openssl=/usr/local/src/openssl-1.0.1h

useradd www -g www

make

make install

5.添加nginx管理脚本,设置开机启动

#!/bin/sh

#

# nginx - this script starts and stops the nginx daemon

#

# chkconfig: - 85 15

# description: Nginx is an HTTP(S) server, HTTP(S) reverse \

# proxy and IMAP/POP3 proxy server

# processname: nginx

# config: /etc/nginx/nginx.conf

# config: /etc/sysconfig/nginx

# pidfile: /var/run/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/nginx/sbin/nginx"

prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

make_dirs() {

# make required directories

user=`$nginx -V 2&1 | grep "configure arguments:" | sed 's/[^*]*--user=\(手机网站建设[^ ]*\).*/\1/g' -`

if [ -z "`grep $user /etc/passwd`" ]; then

useradd -M -s /bin/nologin $user

fi

options=`$nginx -V 2&1 | grep 'configure arguments:'`

for opt in $options; do

if [ `echo $opt | grep '.*-temp-path'` ]; then

value=`echo $opt | cut -d "=" -f 2`

if [ ! -d "$value" ]; then

# echo "creating" $value

mkdir -p $value && chown -R $user $value

fi

fi

done

}

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

make_dirs

echo -n $"Starting $prog: "

daemon $nginx 企业购物网站建设方案 -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $"Stopping $prog: "

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

return $retval

}

restart() {

configtest || return $?

stop

sleep 1

start

}

reload() {

configtest || return $?

echo -n $"Reloading $prog: "

killproc $nginx 恩施网站建设公司 -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status /dev/null 2&1

}

case "$1" in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"

exit 2

esac

6、使用以上代码时,请注意代码的中英文字符在复制过程中是不是有变化。执行:vim /etc/init.d/nginx 。按I编辑,贴入上方脚本。按Esc,然后按:键,输入wq,回车保存。接着执行以下代码:

chkconfig 潜江网站建设公司 --add /etc/init.d/nginx  

service nginx start

chkconfig --level 2345 nginx on

6.nginx有关路径:nginx:/usr/local/nginx ,nginx.conf:/usr/local/nginx/conf/nginx.conf

二、yum快速安装MariaDB 10.1.5

1.添加MariaDB源:

cd /etc/yum.repos.d  

vim MariaDB.repo

#输入如下内容

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.1.5/centos6-amd64/

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

#保存退出

2.安装启动MariaDB

yum install MariaDB-server MariaDB-client MariaDB-devel  

service mysql start

3.更改MariaDB root密码:/usr/bin/mysqladmin -u root password '你的密码'

4.设置MariaDB字符集:

cd /etc/my.cnf.d  

vim server.cnf

#在[mysqld]段下加入

character-set-server=utf8

#在[server]段上方输入

[client]

default-character-set=utf8

#保存退出

service mysql restart

5.编辑完后如下图:

5.建立ghost数据库

mysql -uroot -p你的密码  

#MariaDB表示在mysql客户端中输入

MariaDBCREATE DATABASE ghost;

MariaDBquit

6.MariaDB配置文件路径:my.cnf:/etc/my.cnf ,my.cnf引用:/etc/my.cnf.d

三、安装node.js v0.12.4

1.下载node.js二进制源码包(这个是编译好的程序,可直接使用,只要设置环境变量即可)

cd /usr/local  

wget http://nodejs.org/dist/v0.12.4/node-v0.12.4-linux-x64.tar.gz

tar xzvf node-v0.12.4-linux-x64.tar.gz

cd node-v0.12.4-linux-x64

2.设置环境变量:

vim /etc/profile  

#在export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL上方加入

export NODE_HOME=/usr/local/node-v0.12.4-linux-x64

export PATH=$NODE_HOME/bin:$PATH

#保存退出

source /etc/profile

node -v #查看node.js版本

3.附图:编辑后的/etc/profile


 


 南京牧狼文化传媒有限公司简介:


      牧狼传媒,牧者之心,狼者之性,以牧之谦卑宽容之心待人,以狼之团结无畏之性做事!


  公司注册资金100万,主营众筹全案服务、网站营销全案服务、网站建设、微信小程序开发、电商网店设计、H5页面设计、腾讯社交广告投放以及电商营销推广全案等相关业务,致力于为客户提供更有价值的服务,创造让用户满意的效果!


  为百度官方及其大客户、苏宁易购、金山WPS秀堂、美的、创维家电、新东方在线、伊莱克斯、宝丽莱等国内国外知名品牌服务过,服务经验丰富!同时,公司也是南京电子商务协会会员单位、猪八戒网官方认证签约服务商、江苏八戒服务网联盟、南京浦口文化产业联合会会员单位,可以为您提供更好的服务!


  主营项目:众筹全案服务、网站营销全案服务、网站建设、微信小程序开发、电商网店设计、H5页面设计、腾讯社交广告投放、竞价托管、网站优化、电商代运营等


  合作客户:百度、苏宁易购、饿了么、美的、创维家电、新东方在线、宝丽莱、金山WPS秀堂、伊莱克斯


  资质荣誉:百度商业服务市场2017年度最佳图片服务商、南京电子商务协会会员单位、猪八戒网官方认证签约服务商、江苏八戒服务网联盟、南京浦口文化产业联合会会员单位、八戒通TOP服务商、"易拍即合杯"H5创意大赛"三等奖"。



致力于为客户创造更多价值
13913005726 025-66045668
需求提交
电话咨询
在线咨询