【转】Debian8安装ghost博客
本帖最后由 xlaptx 于 2016/4/11 02:03 编辑一.安装 Nginx
如需加入 HTTP2,缓存,反代 Google等模块请自行使用编译安装nginx方便添加模块
添加源
vi /etc/apt/sources.list(添加下面四行)
deb http://nginx.org/packages/mainline/debian/ jessie nginx
deb-src http://nginx.org/packages/mainline/debian/ jessie nginx
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all (保存退出)
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg
安装
apt-get update
apt-get upgrade
apt-get install nginx
二.安装 MariaDB(可选)
apt-get install -y mariadb-server mariadb-client
三.安装 Node.js
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash (这里完成后要断开SSH再重新登录一次)
nvm install 4.2.0
四.安装Ghost
wget https://ghost.org/zip/ghost-latest.zip
unzip -d ghost ghost-latest.zip
cd ghost
npm install --production
五.配置Ghost
编辑 config
cp config.example.js config.js
修改域名
url: 'http://my-ghost-blog.com', 修改成 url: 'http://你的域名',
修改连接方式
server: {
host: '127.0.0.1',
port: '2368'
}
替换为
server: {
socket: {
path: '/xxxx/ghost/socket.sock', (xxxx是指ghost安装路径)
permissions: '0666'
}
}
修改邮箱
mail: {
transport: 'SMTP',
from: '发件人地址',
options: {
host: 'smtp 邮件发送服务器',
secureConnection: true, // 填 true 则使用加密传输.false 则不
port: 465, //如果上面填 true,这里填465;如果上面填 false,这里填 25
auth: {
user: '邮箱地址',
pass: 'A邮箱密码'
}
}
},
修改数据库 如果,你想使用 sqlite 的话,则不用改,如果使用MariaDB则改。
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
MariaDB(Mysql)
database: {
client: 'mysql', // MariaDB 也填这个
connection: {
host : 'localhost', //如果使用 RDS 等云数据库则修改为连接地址
user : '用户名称',
password : '用户密码',
database : '数据库名称',
charset: 'utf8' //字符集
},
debug: false
},
这里的话,默认连接次数是 min: 2, max: 10,如果需要改动,则添加:
pool: {
min: 2,
max: 20
}
一直保持连接,则设置 min: 0
六.安装pm2 保持 ghost后台运行
npm install pm2
NODE_ENV=production pm2 start index.js --name "ghost" (在博客目录中运行)
pm2 startup debian
pm2 save
七.Nginx 反代 ghostvi /etc/nginx/conf.d/ghost.conf (新建反代ghost的配置)
配置文件如下
server {
listen 80;
server_name blog.tse.moe; (修改为自己博客域名
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://ghost_upstream;
proxy_hide_header Vary;
proxy_hide_header Cache-Control;
}
upstream ghost_upstream {
server unix:/var/www/blog.tse.moe/socket.sock;
keepalive 64;
}
service nginx restart(重启nginx)
最后可以用浏览器打开博客进行最后的配置啦,安装完成,撒花QAQ
原文链接 本帖最后由 xlaptx 于 2016/4/11 02:16 编辑
还有就是网站首页www.tse.moe扒了本站的首页,不知站长樱同意不0.0,不让我就撤下了(T_T) xlaptx 发表于 2016/4/11 02:14
还有就是网站首页www.tse.moe扒了本站的首页,不知站长樱同意不0.0,不让我就撤下了(T_T)
没事,感谢莴苣的dalao帖子
页:
[1]