简介:

利用免费云服务部署个人博客


###一、注册openshift

点击注册


###二、安装Ghost

Applications - Add Applications

找到 Ghost x.x.x 点进去Public URL 随便写如:ghost

拉到下面点 Create Application


###三、配置域名

Applications - 进入自己的应用

Change添加个人域名,Add alia进入新页面填入自己的域名就行了如:www.lxy520.net

进入域名解析如:万网 添加CNAME 指向 应用地址类似: xxx-xxxx.rhcloud.com

打开Git bash

执行

1
2
cd ~/.ssh
cat id_rsa.pub # 没有的话选运行 ssh-keygen -t rsa -C “您的邮箱地址”

Settings - Add a new key...

复制id_rsa.pub里的内容到大的编辑框,第一行名称可以随便写,然后保存

然后复制应用页面的 Source Code 类似: `xxxx@xxx-xxxx.rhcloud.com` 的地址

Git bash 执行:

1
ssh xxxx@xxx-xxxx.rhcloud.com #如: ssh 5581340d50044601a3000167@ghost-ystyle.rhcloud.com

远程到openshift后(可以用其它工具连接如xshell)

1
2
3
#安装主题 其它主题下载:http://marketplace.ghost.org/
cd ${OPENSHIFT_REPO_DIR}/themes/
git clone https://github.com/fabienwang/Ghost-Flat.git
1
2
3
#配置Ghost博客
cd ${OPENSHIFT_REPO_DIR}
vim config.js #按i进入编辑模式,修改第一页和下几页的production下的url为自己的域名 如:http://www.lxy520.net 然后按Esc输入:wq 按回车退出
1
2
3
4
#实现openshift自动重启
cd ${OPENSHIFT_REPO_DIR}.openshift/cron/hourly
wget http://dl-cystc.qiniudn.com/openshift/restart.sh
chmod 711 restart.sh
1
2
#重启应用, 安装主题与修改config.js 时需要重启应用
ctl_all restart

###四、初始化博客

用自己的域名进入博客,在地址栏加上/ghost

输入用户名,邮箱,密码初始化博客

完成之后, 后台页面 content 管理文章,New post发布博客, Setting设置博客基本信息