设为首页收藏本站

ZMX - IT技术交流论坛 - 无限Perfect,追求梦想 - itzmx.com

 找回密码
 注册论坛

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

用百度帐号登录

只需两步,快速登录

搜索
查看: 2668|回复: 2

【转】Debian8安装ghost博客

[复制链接]

签到天数: 132 天

[LV.7]常住居民III

发表于 2016/4/11 01:47 | 显示全部楼层 |阅读模式 |Google Chrome 49.0.2623.112|GNU/Linux x64
天涯海角搜一下: 百度 谷歌 360 搜狗 有道 雅虎 必应 即刻
本帖最后由 xlaptx 于 2016/4/11 02:03 编辑

一.安装 Nginx

如需加入 HTTP2,缓存,反代 Google等模块请自行使用编译安装nginx方便添加模块

添加源
  1. vi /etc/apt/sources.list  (添加下面四行)
  2. deb http://nginx.org/packages/mainline/debian/ jessie nginx
  3. deb-src http://nginx.org/packages/mainline/debian/ jessie nginx
  4. deb http://packages.dotdeb.org jessie all
  5. deb-src http://packages.dotdeb.org jessie all   (保存退出)
  6. wget http://nginx.org/keys/nginx_signing.key
  7. apt-key add nginx_signing.key
  8. wget https://www.dotdeb.org/dotdeb.gpg
  9. apt-key add dotdeb.gpg
复制代码


安装
  1. apt-get update
  2. apt-get upgrade
  3. apt-get install nginx
复制代码


二.安装 MariaDB(可选)
  1. apt-get install -y mariadb-server mariadb-client
复制代码


三.安装 Node.js
  1. wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash (这里完成后要断开SSH再重新登录一次)
  2. nvm install 4.2.0
复制代码


四.安装Ghost
  1. wget https://ghost.org/zip/ghost-latest.zip
  2. unzip -d ghost ghost-latest.zip
  3. cd ghost
  4. npm install --production
复制代码


五.配置Ghost
编辑 config
  1. cp config.example.js config.js[code]

  2. 修改域名
  3. [code]url: 'http://my-ghost-blog.com', 修改成 url: 'http://你的域名',
复制代码


修改连接方式
  1. server: {
  2.     host: '127.0.0.1',
  3.     port: '2368'
  4. }
复制代码

替换为
  1. server: {
  2.     socket: {
  3.     path: '/xxxx/ghost/socket.sock',   (xxxx是指ghost安装路径)
  4.     permissions: '0666'
  5.   }
  6. }
复制代码


修改邮箱
  1. mail: {
  2.        transport: 'SMTP',
  3.        from: '发件人地址',
  4.        options: {
  5.                  host: 'smtp 邮件发送服务器',
  6.                  secureConnection: true, // 填 true 则使用加密传输.false 则不
  7.                  port: 465, //如果上面填 true,这里填465;如果上面填 false,这里填 25
  8.                  auth: {
  9.                         user: '邮箱地址',
  10.                         pass: 'A邮箱密码'
  11.                         }
  12.                 }
  13.             },
复制代码

修改数据库 如果,你想使用 sqlite 的话,则不用改,如果使用MariaDB则改。

  1. database: {
  2.         client: 'sqlite3',
  3.         connection: {
  4.             filename: path.join(__dirname, '/content/data/ghost.db')
  5.         },

  6. MariaDB(Mysql)
  7.     database: {
  8.         client: 'mysql', // MariaDB 也填这个
  9.         connection: {
  10.             host     : 'localhost', //如果使用 RDS 等云数据库则修改为连接地址
  11.             user     : '用户名称',
  12.             password : '用户密码',
  13.             database : '数据库名称',
  14.             charset  : 'utf8' //字符集
  15.         },
  16.         debug: false
  17.     },
复制代码

这里的话,默认连接次数是 min: 2, max: 10,如果需要改动,则添加:

  1. pool: {
  2.   min: 2,
  3.   max: 20
  4. }
复制代码

一直保持连接,则设置 min: 0

六.安装pm2 保持 ghost后台运行
  1. npm install pm2
  2. NODE_ENV=production pm2 start index.js --name "ghost" (在博客目录中运行)
  3. pm2 startup debian
  4. pm2 save
复制代码


七.Nginx 反代 ghostvi /etc/nginx/conf.d/ghost.conf (新建反代ghost的配置)
配置文件如下
  1. server {
  2.     listen 80;
  3.     server_name blog.tse.moe;   (修改为自己博客域名
  4.     }

  5. location / {
  6.     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  7.     proxy_set_header   Host $http_host;
  8.     proxy_set_header   X-Forwarded-Proto $scheme;
  9.     proxy_set_header   X-Real-IP $remote_addr;
  10.     proxy_set_header   Host      $http_host;
  11.     proxy_pass http://ghost_upstream;
  12.     proxy_hide_header Vary;
  13.     proxy_hide_header Cache-Control;
  14. }
  15.   upstream ghost_upstream {
  16.   server unix:/var/www/blog.tse.moe/socket.sock;
  17.   keepalive 64;
  18. }
复制代码

  1. service nginx restart  (重启nginx)
复制代码


最后可以用浏览器打开博客进行最后的配置啦,安装完成,撒花QAQ
原文链接
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复

使用道具 举报

签到天数: 132 天

[LV.7]常住居民III

 楼主| 发表于 2016/4/11 02:14 | 显示全部楼层 |Google Chrome 49.0.2623.112|GNU/Linux x64
本帖最后由 xlaptx 于 2016/4/11 02:16 编辑

还有就是网站首页www.tse.moe扒了本站的首页,不知站长樱同意不0.0,不让我就撤下了(T_T)
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

 成长值: 54

签到天数: 4643 天

[LV.Master]伴坛终老

发表于 2016/4/11 03:22 | 显示全部楼层 |Google Chrome 49.0.2623.110|Windows 10
xlaptx 发表于 2016/4/11 02:14
还有就是网站首页www.tse.moe扒了本站的首页,不知站长樱同意不0.0,不让我就撤下了(T_T)

banner.jpg 没事,感谢莴苣的dalao帖子
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册论坛 新浪微博账号登陆用百度帐号登录

本版积分规则

手机版|Archiver|Mail me|网站地图|IT技术交流论坛 ( 闽ICP备13013206号-7 )

GMT+8, 2024/9/20 14:28 , Processed in 0.144972 second(s), 23 queries , MemCache On.

Powered by itzmx! X3.4

© 2011- sakura

快速回复 返回顶部 返回列表