一、简介
跟静态博客不同的是,Ghost 这种轻量级的动态博客,有一个管理后台,可以直接写作和管理博客。本质上,跟 WordPress 是相通的,只是 Ghost 搭建在 Node.js 环境上,轻量,快速,简洁。
二、更新操作系统
* 首先更新系统版本
wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo wget-O/etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-7.repo yummakecache yumupdate
三、安装nginx
* 配置安装源
vi/etc/yum.repo.d/nginx.repo
[nginx] name=nginxrepo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
* 安装并启动nginx
yuminstallnginx systemctlenablenginx systemctlstartnginx ps-ef|grepnginx
* 配置nginx
vim/etc/nginx/conf.d/blog.conf
server{ listen80; server_nameblog.waringid.me//这里修改为你的域名;如果没有域名,则输入服务器公网IP地址; location/{ proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerHost$http_host; proxy_passhttp://127.0.0.1:2368; } }
四、安装Node.js
* 安装nvm
curl-o-https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh|bash source.bashrc nvmls nvminstall4.2
* 安装Ghost
curl-Lhttps://ghost.org/zip/ghost-latest.zip-oghost.zip unzip-uoghost.zip-d/var/www/html/ghost chown-Rnginx:nginx/var/www/html/ghost/ cd/var/www/html/ghost/ npminstall--production cpconfig.example.jsconfig.js vimconfig.js
production:{ url:'http://blog.waringid.me',mail:{},database:{ client:'sqlite3',connection:{ filename:path.join(__dirname,'/content/data/ghost.db') },debug:false },server:{ host:'127.0.0.1',port:'2368' } },
* 安装PM2
npminstall-gpm2 NODE_ENV=productionpm2startindex.js--name"ghost" pm2startupcentos pm2save systemctlreloadnginx
网站效果:http://blog.waringid.me。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。