编译node
#更新 yum 的 repo list
rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm
#同时安装 node 和 npm
sudo yum install nodejs npm --enablerepo=epel
安装nginx
#下载 repo 列表
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
#通过 rpm 添加列表
rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
#通过 yum 安装 nginx
yum install nginx
#将 nginx 设置为开机启动(可选,推荐)
chkconfig nginx on
#启动 nginx 服务
service nginx start
安装MySQL
--rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi,remi-test install mysql mysql-server
service mysqld start
chkconfig mysqld on
安装Ghost
cd /var && mkdir www && cd www
wget http://dl.ghostchina.com/Ghost-0.7.4-zh-full.zip && unzip Ghost*
安装MYSQL
mysql_secure_installation
运行上述命令可以进入 MySQL 的交互式安装程序,基本流程是:
1.输入安装 MySQL 时指定的 root 密码,一般直接按回车
2.是否改变 root 密码,输入 y
3.输入新的 root 密码
4.是否删除匿名用户,输入 y
5.是否禁止 root 远程登录,输入 y
6.是否删除默认的 test 数据库,输入 y
7.是否马上应用最新的设置,输入 y
#登录MySQL
mysql -u root -p 你的密码
#创建名为ghost的用户并新建名为ghost的数据库,同时给ghost用户授予ghost数据库的所有权限
CREATE DATABASE ghost;
GRANT ALL PRIVILEGES ON ghost.* To 'ghost'@'127.0.0.1' IDENTIFIED BY '为ghost用户设置一个与root不同的密码';
配置nginx
cd /etc/nginx/conf.d
vim /etc/nginx/conf.d/default.conf
server {
listen 80;
#你的域名
server_name byxfei.com;
#访问日志地址
#access_log /var/log/nginx/log/host.access.log main;
#下面几个location都是让nginx直接serve静态文件
location ~ ^/(img/|css/|lib/|vendor/|fonts/|robots.txt|humans.txt) {
root /var/www/core/client/assets;
access_log off;
expires max;
}
location ~ ^/(shared/|built/) {
root /var/www/core;
access_log off;
expires max;
}
location ~ ^/(favicon.ico) {
root /var/www/core/shared;
access_log off;
expires max;
}
location ~ ^/(content/images/) {
root /var/www;
access_log off;
expires max;
}
#核心block,将请求proxy到Ghost实例上
#其中端口可以在Ghost的config.js中修改,但要保持一致
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}
service nginx restart
配置Ghost
cd /var/www
mv config.example.js config.js
vim config.js
...
production: {
url: 'http://byxfei.com', //替换为你自己的域名。
mail: {},
database: {
client: 'mysql',
connection: {
host : '127.0.0.1',
user : 'ghost', //上面配置过
password : 'ghost对应的密码', //上面配置过
database : 'ghost', //我们前面为 Ghost 创建的数据库名称
charset : 'utf8'
}
},
server: {
host: '127.0.0.1',
port: '2368'//若修改该端口记得在nginx中做相应改变
}
},
...
npm install --production
安装forever
npm install forever -g
cd /var/www
NODE_ENV=production forever start index.js
vim /etc/rc.local
# ghost auto start
NODE_ENV=production /usr/lib/node_modules/forever/bin/forever --minUptime=1000 --spinSleepTime=1000 start /var/www/index.js
查看启动日志
cat /var/log/boot.log
--重启forever
cd /var/www && forever stop index.js && NODE_ENV=production forever start index.js
安装主题
cd /var/www/content/themes
wget https://github.com/onevcat/vno/archive/master.zip && unzip -d master
mv /var/www/content/themes/master /var/www/content/themes/onevcat
rm master.zip master
安装代码高亮 highLight.js
cd /var/www/content/themes/casper-zh/assets
wget
atelier-heath-dark
网站底部版权信息修改
vim /var/www/content/themes/casper-zh/default.hbs
添加评论插件
cd /var/www/content/themes/casper-zh
vi post.hbs