折腾教程
GHOST 依赖
yum update -y |
安装 Ghost Client
cnpm i -g ghost-cli |
安装 Ghost
添加 Ghost 运行用户并创建目录
adduser ghost
mkdir /var/www
mkdir /var/www/ghost
chown ghost /var/www/ghost安装 Ghost
切换到ghost用户安装并启动ghost
su ghost
本教程以 SQLite3 作为 Ghost 的数据库。
cd /var/www/ghost
ghost install local --db=sqlite3Ghost 停止、启动、重启命令
ghost stop
ghost start
ghost restart安装成功后默认是运行在
http://localhost:2368/
,如果需要对外访问,则需要通过 Nginx 进行反向代理。
Nginx
安装
切换回root用户以免出现权限问题
su root
使用以下命令添加 CentOS 7 Nginx yum 资源库:
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装:
yum install -y nginx
Nginx配置反向代理
修改 config 文件(请确保 Ghost 已经在运行阶段方可进行如下操作。)
vi /etc/nginx/conf.d/default.conf
运行上面的命令后,再键入
i
然后移动光标在约第七行修改相关文件代码:location / {
root /usr/share/nginx/html;
index index.html index.htm;
}改为:
location / {
proxy_pass http://127.0.0.1:2368;
proxy_redirect default;
root /usr/share/nginx/html;
index index.html index.htm;
}重启Nginx使配置生效
systemctl restart nginx.service
切换到ghost用户
su ghost
启动ghost
ghost start
server { |