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)
上一篇 2021年6月1日 上午11:00
下一篇 2021年6月1日 下午12:00


相关推荐

  • 圣杯布局的原理

    圣杯布局的原理圣杯布局的起源InSearchoftheHolyGrail圣杯布局解决的问题两边定宽,中间自适应的三栏布局,中间栏要放在文档流前面以优先渲染。圣杯布局的原理HTML代码<divclass="content"><divclass="centercol"></div><divclass="leftcol"></div>

    2022年6月28日
    25
  • ping命令和tracert命令的作用_ping命令有哪些

    ping命令和tracert命令的作用_ping命令有哪些本文只是总结了两个常用的网络命令的实现原理和一点使用经验说明。这些东西通常都分布在各种书籍或者文章中的,我勤快那么一点点,总结一下,再加上我的一点理解和使用经验,方便大家了解。这些也是很基础的东西,没什么高深的。Ping这个应该大家都会用的吧,最主要的就是检测目标主机是不是可连通。Ping程序实际就是发送一个ICMP回显请求报文(就是请求别人收到这个报文之后回显)给目的主机,并等待回显的ICM…

    2026年3月5日
    4
  • SheetJs解析EXCEL

    SheetJs解析EXCELSheetJs 解析 EXCELSheetJs 上代码解析的 excel 表格式解析后生成的 sql 脚本 SheetJs 不介绍了 自己百度吧 上代码要做的功能就是解析 excel 并转换为 sql 脚本 html head metahttp equiv Content Type content text html charset UTF 8 quot metahttp equiv Content Type content text head html

    2026年3月17日
    2
  • python最新激活码2021【在线注册码/序列号/破解码】「建议收藏」

    python最新激活码2021【在线注册码/序列号/破解码】,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月19日
    1.7K
  • 在 CentOS 7.3 上安装 nginx 服务为例,说明在 Linux 实例中如何检查 TCP 80 端口是否正常工作…

    在 CentOS 7.3 上安装 nginx 服务为例,说明在 Linux 实例中如何检查 TCP 80 端口是否正常工作…

    2021年10月18日
    45
  • PHPProxy建立代理服务器

    PHPProxy建立代理服务器隆重介绍 PHPProxy 这个小软件 点这里访问它的下载页 它能将一个 PHP 空间变成一台代理服务器 代理的好处自然很多 绕过伟大的防火长城的域名劫持和 IP 禁止 如果有 SSL 还能绕过它的关键词审查 当然随着 wikipedia 和 sf 的解禁 至少对我来说可以暂时忽视 GFW 了 然而代理不仅仅如此 试想如果你有一个教育网电信网通互联的空间 却没有 SSH 权限来使用 SSHTunnel 看到了可以用一个

    2026年3月19日
    2

发表回复

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

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