在CentOS7上部署Ghost博客-创新互联

一、简介
 跟静态博客不同的是,Ghost 这种轻量级的动态博客,有一个管理后台,可以直接写作和管理博客。本质上,跟 WordPress 是相通的,只是 Ghost 搭建在 Node.js 环境上,轻量,快速,简洁。
二、更新操作系统
* 首先更新系统版本

创新互联专注骨干网络服务器租用十年,服务更有保障!服务器租用,德阳机房服务器托管 成都服务器租用,成都服务器托管,骨干网络带宽,享受低延迟,高速访问。灵活、实现低成本的共享或公网数据中心高速带宽的专属高性能服务器。
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 
yum makecache  
yum update

三、安装nginx
* 配置安装源

vi /etc/yum.repo.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

* 安装并启动nginx

yum install nginx  
systemctl enable nginx  
systemctl start nginx  
ps -ef |grep nginx

* 配置nginx

vim /etc/nginx/conf.d/blog.conf
server {  
    listen 80;
    server_name blog.waringid.me // 这里修改为你的域名;如果没有域名,则输入服务器公网 IP 地址;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
    }
}

四、安装Node.js
* 安装nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash  
source .bashrc  
nvm ls  
nvm install 4.2

在CentOS 7上部署Ghost博客

* 安装Ghost

curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip  
unzip -uo  ghost.zip -d /var/www/html/ghost  
chown -R nginx:nginx /var/www/html/ghost/  
cd /var/www/html/ghost/  
npm install --production  
cp config.example.js config.js  
vim config.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

npm install -g pm2  
NODE_ENV=production pm2 start index.js --name "ghost"  
pm2 startup centos  
pm2 save
systemctl reload nginx

在CentOS 7上部署Ghost博客
五、测试
在CentOS 7上部署Ghost博客


网站效果:http://blog.waringid.me。

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前名称:在CentOS7上部署Ghost博客-创新互联
文章分享:http://myzitong.com/article/gehge.html