新建用户, 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
下载本文