当前位置: 移动技术网 > IT编程>开发语言>JavaScript > centos 上快速搭建ghost博客方法分享

centos 上快速搭建ghost博客方法分享

2018年05月29日  | 移动技术网IT编程  | 我要评论

1. 介绍

ghost 是一套基于 node.js 构建的开源博客平台,具有易用的书写界面和体验,博客内容默认采用 markdown 语法书写,目标是取代臃肿的 wordpress。本篇文章主要是介绍在如何在centos7.3上快速搭建ghost博客平台,采用yum安装mysql、nginx软件。

2. 安装

安装mysql

wget -i -c
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql mysql-server
systemctl enable mysqld.service
systemctl start  mysqld.service
mysql -uroot -p   # 初始密码为空
mysql> use mysql;
mysql> update user set password=password('********') where user='root';
mysql> flush privileges;
mysql> flush privileges;
mysql> exit;

新建用户, ghost不能用root运行,官方已做说明()

useradd ops
usermod -ag wheel ops
passwd ops
su - ops

安装nginx和node.js

sudo yum -y update
sudo yum -y install nginx nodejs

安装ghost

sudo npm i -g ghost-cli
sudo chown ops.ops /var/www/ghost/
sudo chmod 755 /var/www/ghost/
cd /var/www/ghost/
ghost install

安装过程中的交互问题:

3. 启动博客

执行完上面的安装过程,会告诉你如何启动自己的博客,我的启动方式如下:

sudo systemctl start ghost_jidongdong-cn

配置nginx

# cat /etc/nginx/conf.d/jidongdong.cn.conf
server {
        listen 80;
        server_name blog.jidongdong.cn;
        location / {
                proxy_pass  ;
                proxy_set_header host blog.jidongdong.cn;
                proxy_set_header    x-forwarded-for $remote_addr;
        }
}
# service nginx restart

4. 登录

浏览器输入你的域名或者主机ip即可登录。后台管理界面默认为:http://[域名]/ghost

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网