温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos上怎么快速搭建ghost博客

发布时间:2021-02-20 12:42:59 来源:亿速云 阅读:251 作者:小新 栏目:web开发

小编给大家分享一下centos上怎么快速搭建ghost博客,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

1. 介绍

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

2. 安装

安装mysql

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
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运行,官方已做说明(https://docs.ghost.org/docs/install)

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

安装过程中的交互问题:

https://docs.ghost.org/docs/cli-install#section-prompts

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  http://127.0.0.1:2368;
                proxy_set_header Host blog.jidongdong.cn;
                proxy_set_header    X-Forwarded-For $remote_addr;
        }
}
# service nginx restart

4. 登录

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

看完了这篇文章,相信你对“centos上怎么快速搭建ghost博客”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI