CentOS搭建Ghost博客

CentOS搭建Ghost博客

参考:腾讯云手动实验https://cloud.tencent.com/developer/labs/lab/10281

Ghost 是一款非常出色的开源博客平台,界面简洁,专注写作。CentOS 7 上安装 Ghost ,包括安装 Nodejs 环境以及配置
Nginx 对 Ghost 的代理请求等步骤。

安装Node.js及相关包

限制使用node.js版本^8.16.0 || ^10.13.0 || ^12.10.0

[root@localhost ~]# yum -y update
[root@localhost ~]# yum groupinstall -y "Development Tools" \
--setopt=group_package_types=mandatory,default,optional
[root@localhost ~]# wget https://npm.taobao.org/mirrors/node/v12.16.2/node-v12.16.2-linux-x64.tar.xz
[root@localhost ~]# tar xf node-v12.16.2-linux-x64.tar.xz 
[root@localhost ~]# mv node-v12.16.2-linux-x64 /usr/local/nodejs
[root@localhost ~]# vim /etc/profile
# 末尾添加
export PATH=$PATH:/usr/local/nodejs/bin
[root@localhost ~]# source /etc/profile
[root@localhost ~]# node -v
v12.16.2
[root@localhost ~]# npm -v
6.14.4
[root@localhost ~]# npm config set registry https://registry.npm.taobao.org
[root@localhost ~]# npm i -g cnpm

安装成功后通过运行node -v及npm -v 出现版本号即可表示安装成功。

因为国内网络的关系,也同时安装了 cnpm 模块,后续将使用该命令代替 npm 命令。

安装Ghost Client

[root@localhost ~]# cnpm i -g ghost-cli
...
[ghost-cli@1.13.1] link /usr/bin/ghost@ -> /usr/lib/node_modules/ghost-cli/bin/ghost
[root@localhost ~]# ghost -v
Ghost-CLI version: 1.13.1

一般而言,安装成功后通过运行 ghost -v,出现版本号即可表示安装成功。但因为国内的网络问题,安装后请检查下终端的 log,如果有出现任意红色报错信息,则证明只有部分安装成功,需要重新执行命令安装。

安装Ghost
添加Ghost程序用户,并创建目录

[root@localhost ~]# adduser ghost
[root@localhost ~]# mkdir -p /var/www/ghost
[root@localhost ~]# chown ghost /var/www/ghost/

安装Ghost

[root@localhost ~]# su ghost
[ghost@localhost root]$ cd /var/www/ghost/
[ghost@localhost ghost]$ ghost install local --db=sqlite3
# 这里需要相当长的时间
✔ Checking system Node.js version
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking for latest Ghost version
✔ Setting up install directory
✔ Downloading and installing Ghost v3.14.0
✔ Finishing install process
✔ Configuring Ghost
✔ Setting up instance
✔ Starting Ghost

Ghost uses direct mail by default. To set up an alternative email method read our docs at https://ghost.org/docs/concepts/config/#mail

------------------------------------------------------------------------------

Ghost was installed successfully! To complete setup of your publication, visit: 

    http://localhost:2368/ghost/

启动Ghost

[ghost@localhost ghost]$ ghost start
Ghost is already running! For more information, run: 
    ghost ls
[ghost@localhost ghost]$ ghost ls
┌─────────────┬────────────────┬─────────┬───────────────────────┬────────────────────────┬──────┬─────────────────┐
│ Name        │ Location       │ Version │ Status                │ URL                    │ Port │ Process Manager │
├─────────────┼────────────────┼─────────┼───────────────────────┼────────────────────────┼──────┼─────────────────┤
│ ghost-local │ /var/www/ghost │ 3.40.5  │ running (development) │ http://localhost:2368/ │ 2368 │ local           │
└─────────────┴────────────────┴─────────┴───────────────────────┴────────────────────────┴──────┴─────────────────┘

安装nginx
配置yum源

[ghost@localhost ghost]$ exit
exit
[root@localhost ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装nginx

[root@localhost ~]# yum -y install nginx

启动nginx

[root@localhost ~]# systemctl start nginx

配置反向代理
修改nginx配置文件

[root@localhost ~]# vim /etc/nginx/conf.d/default.conf
    location / {
   
        proxy_pass http://127.0.0.1:2368;
        proxy_redirect default;
        root    /usr/share/nginx/html;
        index   index.html index.htm;
    }

重启nginx

[root@localhost ~]# nginx -s stop 
[root@localhost ~]# nginx

验证
访问http://192.168.1.10/ghost/
在这里插入图片描述
在这里插入图片描述
http://192.168.1.10
在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/101873.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 深入解析Linux Platform_device 及驱动

    深入解析Linux Platform_device 及驱动[导读]前文分析了Linux设备驱动的驱动模型,本文来聊聊Platform_driver/Platform_device这个类。做嵌入式Linux的驱动,这个也是绕不开的,所以来学习分析总结一下。

    2022年7月3日
    20
  • 一个永久免费的图片鉴黄api接口「建议收藏」

    一个永久免费的图片鉴黄api接口「建议收藏」相关说明本项目是一个图片鉴黄api接口,支持jpg、png、jpeg格式文件,参考nsfwjs。接口地址https://checkimage.querydata.org/api使用示例#/root/xx.png为图片路径curlhttps://checkimage.querydata.org/api-F”image=@/root/xx.png;type=image/jpeg”返回信息:[{“className”:”Neutral”,

    2022年9月28日
    0
  • 更新本地DNS缓存列表[通俗易懂]

    更新本地DNS缓存列表[通俗易懂]更新本地DNS缓存列表当我们以域名形式访问过目标网站后,该网站的域名和IP地址对应关系就会自动保存到本地工作站的DNS缓存列表中,日后IE浏览器会优先访问DNS缓存列表中的信息,不过一旦此时目标站点的域名和IP地址对应关系发生变动的话,DNS缓存列表中的对应解析记录不会跟着同步变化,那么日后我们再次以域名形式访问目标站点时就容易发生DNS解析不成功的故障。这个时候,…

    2022年5月5日
    95
  • 小米手机如何root权限获取_小米8root权限获取

    小米手机如何root权限获取_小米8root权限获取小米系统通过什么方法拥有root超级权限?我们都清楚,安卓机器有root超级权限,如果手机拥有root相关权限,能够实现更好的功能,打个比方我们企业的营销部门的同事,使用大多数营销应用都需要在root

    2022年8月5日
    19
  • 原生JS 扫雷游戏 自动插旗子 自定义雷区大小 雷数可调

    原生JS 扫雷游戏 自动插旗子 自定义雷区大小 雷数可调《扫雷》是Microsoft于1992年附带在Windows3.1操作系统中的单机游戏,它通过点击方格并以出现数字来判断附近雷的数量,将全部地雷做上标记即可胜利。最后在2015年7月发布的Windows10中移除了这个游戏。随机变换雷区颜色,以及其它CSS样式,动画效果全是CSS。点击网页上的元素触发游戏事件打开雷区。如果对于一个方格,其周围未打开的方格恰好全都有雷,那么这些雷将全部自动被标记为小红旗,而玩家只需要一直点击雷区直至雷区全被打开并胜利呈现YOUWIN~没错,全程左键操作。在地

    2022年4月30日
    91
  • python skitlearn_Python sklearn

    python skitlearn_Python sklearn1.Sklearn简介Scikit-learn(sklearn)是机器学习中常用的第三方模块,对常用的机器学习方法进行了封装,包括回归(Regression)、降维(DimensionalityReduction)、分类(Classfication)、聚类(Clustering)等方法。当我们面临机器学习问题时,便可根据下图来选择相应的方法。Sklearn具有以下特点:简单高效的数据挖…

    2022年8月31日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号