在CentOS 7上部署Ghost部落格
阿新 • • 發佈:2018-12-21
作者:waringid
一、簡介
跟靜態部落格不同的是,Ghost 這種輕量級的動態部落格,有一個管理後臺,可以直接寫作和管理部落格。本質上,跟 WordPress 是相通的,只是 Ghost 搭建在 Node.js 環境上,輕量,快速,簡潔。
二、更新作業系統
首先更新系統版本
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum makecache yum update
三、安裝nginx
配置安裝源
vi /etc/yum.repo.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
安裝並啟動nginx
yum install nginx
systemctl enable nginx
systemctl start nginx
ps -ef |grep nginx
配置nginx
vim /etc/nginx/conf.d/blog.conf
server { listen 80; server_name blog.waringid.me // 這裡修改為你的域名;如果沒有域名,則輸入伺服器公網 IP 地址; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; } }
四、安裝Node.js
安裝nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
source .bashrc
nvm ls
nvm install 4.2
安裝Ghost
curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip unzip -uo ghost.zip -d /var/www/html/ghost chown -R nginx:nginx /var/www/html/ghost/ cd /var/www/html/ghost/ npm install --production cp config.example.js config.js vim config.js
production: {
url: 'http://blog.waringid.me',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
host: '127.0.0.1',
port: '2368'
}
},
安裝PM2
npm install -g pm2
NODE_ENV=production pm2 start index.js --name "ghost"
pm2 startup centos
pm2 save
systemctl reload nginx
五、測試
轉載請註明:虛擬的現實 » 在CentOS 7上部署Ghost部落格