在VPS中,推荐下载最新的ghost
1 2 3 4 5 6 7 8 9 10 11
| yum install gcc nodejs npm install -g ghost-cli mkdir /var/www/blog cd /var/www/blog ghost install local http://localhost:2368/ vim config.development.json url: http://www.femnyy.com ghost restart http://www.femnyy.com
|
配置一下nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| vim /etc/nginx/conf.d/ghost.conf server { listen 80; server_name myip www.femnyy.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; } } nginx -t systemctl start nginx systemctl enable nginx setsebool -P httpd_can_network_connect true
|
访问 http://www.femnyy.com or http://myip/ghost
ghost 命令
1 2 3
| ghost -h ghost ls/update/start/stop/restart
|
ghost管理界面的一些基本操作
同时在管理界面能操作的,就不要去动服务器中的ghost代码,本人能力有限,改了几次,配置都不能用了,只能重新安装(在旧版本中)
设置标签 再将Tab 设置成Navigation,同样新版本也可以操作Design了.
备份你的博客 导入博客
Labs –> Export /Import
提高被搜索的概率
setting –> Meta Date –> 输入搜索时的关键字
开始写博客
有关Markdown的语法手册
图片的处理
使用七牛的对象存储 或者用sm.ms支持https
不推荐安装旧版本,旧版本安装不好友,想更新ghost版本也费劲,主要是有可以还安不成功
参考于此
install nodejs and setting npm source
1 2 3 4 5 6 7 8 9 10 11 12
| yum -y update yum install -y gcc-c++ make unzip netstat curl --silent --location https://rpm.nodesource.com/setup_4.x | bash - yum -y install nodejs node -v mkdir -p /var/www/ cd /var/www/ wget https://ghost.org/zip/ghost-latest.zip unzip -uo ghost-latest.zip -d /var/www/ghost cd ghost npm config set registry http://registry.npmjs.org/ npm config set strict-ssl false
|
其中当npm install –production,下载依赖包时,可能会遇到内存不足的问题,可以通过增加交换空间来解决
1 2 3 4 5 6 7 8
| sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k sudo mkswap /swapfile sudo swapon /swapfile vim /etc/fstab echo 10 | sudo tee /proc/sys/vm/swappiness echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf sudo chown root:root /swapfile sudo chmod 0600 /swapfile
|
install ghost
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cd /var/www/ghost npm install --production cp config.example.js config.js vim config.js config = { production: { url: 'http://myip' sudo firewall-cmd --permanent --add-port=80/tcp sudo firewall-cmd --permanent --add-port=2368/tcp firewall-cmd --reload npm start --production ss -lnp |grep 2368 http://localhost:2368/ghost kill -9 **
|
use pm2 manage ghost 之后就可以不用 nohup npm start –production 启动了
1 2 3 4 5 6 7 8
| npm install -g pm2 echo "export NODE_ENV=production" >> ~/.profile . ~/.profile pm2 start index.js --name ghost pm2 show/start/stop ghost pm2 status/logs/save
|
install nginx
1 2 3 4
| yum -y install epel-release yum -y update yum -y install nginx
|
访问 http://www.femnyy.com or http://myip/ghost
如果是在国内安装的话,可能会比较慢,推荐用淘宝镜像安装,你可以使用我们定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm:
1
| npm install -g cnpm --registry=https://registry.npm.taobao.org
|
update nodejs npm
1 2 3
| sudo npm cache clean -f sudo npm install -g n sudo n stable
|
ghost文档帮助