Chost博客已经更新到了1.22版本,下面介绍一下如何在CentOS7中安装.
这里采用Ghost+Mysql+Nginx的方式。node
Mysql安装配置mysql
安装mysqlnginx
rpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm yum -y install mysql-server mysql systemctl start mysqld.service
配置mysqlgit
mysql mysql> create database ghost; mysql> grant all on ghost.* to 'ghost'@localhost identified by 'ghost'; mysql> flush privileges;
这时执行mysql -ughost -pghost,就能够以ghost用户,ghost密码登陆管理ghost数据库.sql
node安装数据库
安装node6npm
curl -sL https://rpm.nodesource.com/setup_6.x | bash - yum install nodejs
验证json
node -v
安装ghost-clibash
安装ghost-clicurl
npm i -g ghost-cli
最好升级一下最新的ghost-cli
yum install -y git
配置加速
npm config set registry https://registry.npm.taobao.org
安装过程
npm i -g ghost-cli to update
配置ghost用户
adduser ghost mkdir /var/www/ghost chown ghost /var/www/ghost
配置sudo权限
groupadd sudo chown -R ghost:sudo /home/ghost/ chmod 775 /home/ghost/ usermod -aG sudo ghost
切换用户安装
su ghost cd /var/www/ghost ghost install local --db mysql
根据提示输入相关信息,便可
[ghost@ming ghost]$ ghost install local --db mysql ✔ 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 v1.22.3 > Installing dependencies > [3/5] Fetching packages...
等待老是漫长...
? Enter your MySQL hostname: localhost ? Enter your MySQL username: ghost ? Enter your MySQL password: [hidden] ? Enter your Ghost database name: ghost ✔ Configuring Ghost ✔ Setting up instance ✔ Running database migrations ℹ Ensuring user is not logged in as ghost user [skipped] ℹ Checking if logged in user is directory owner [skipped] ✔ Checking current folder permissions ✔ Validating config ✔ Checking memory availability ✔ Starting Ghost You can access your blog at http://localhost:2368/ Ghost uses direct mail by default To set up an alternative email method read our docs at https://docs.ghost.org/docs/mail-config
修改配置文件
查看ghost
ghost ls
能够看到ghost如今是运行在开发模式development下,下面修改成生产模式
ghost stop cp config.development.json config.production.json
在配置文件里面修改url,改为你本身的域名便可
vi config.production.json "url": "http://120.27.119.12/" ghost start便可
nginx 反向代理
安装nginx
yum install -y nginx
修改配置
cd /etc/nginx/conf.d/ vi ghost.conf server { listen 80; server_name 120.27.119.12; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; } }
启动nginx
nginx
你们能够访问关注个人我的博客 遂更记忆 www.suigengjiyi.com