zoukankan      html  css  js  c++  java
  • hexo自动部署到git、ftp(虚拟主机等)、云服务器的方式

    自动部署很有用,当你写完文章后,直接使用hexo d就可以自动更新你的网站了

    部署到git

    首先你需要在你的blog下安装git deployer插件:npm install hexo-deployer-git --save,然后再把如下代码添加到你的_config.yml文件中

    ### git deploy
    deploy:
      type: git
      repo: https://github.com/cmlanche/cmlanche.github.io.git  # 你的远程仓库
      branch: master # 你的远程残酷分支
      message: "hello guys" # 每次提交的信息
    

    需要注意的是,部署到git需要再本地安装你ssh key,也就是说允许本地进行读写远程git仓库,否则你会没权限的

    部署到ftp服务器

    你可能会用一台虚拟主机(虚拟主机评测看这里hostreport.cn)来部署你的hexo个人站点,那么fip怎么部署? 首先你需要下载安装ftp deployer插件:npm install hexo-deployer-ftpsync --save,然后把你下面的代码贴到你的_config.yml中,注意修改ftp的相关参数。

    #### ftp deploy
    deploy:
     type: ftpsync
     host: ftpserver # ftp服务器地址
     user: ftpusername # ftp用户名
     pass: xxxx # 你的ftp用户密码
     remote: xxx # 你要上传到的地址,例如/wwwroot
     port: 21 # ftp端口,不同的ftp可能会不一样
     delete: true # 上传本地文件是否删除ftp中的所有文件
     verbose: true # 是否打印调试信息
     ignore_errors: false # 是否忽略错误
    

    部署到远程主机,通常如VPS或者云服务器(评测看这里:hostreport.cn

    同样要下载hexo deployer: npm install hexo-deployer-rsync --save,然后代码奉上:

    deploy:
      type: rsync
      host: <host> # 主机地址
      user: <user> # 用户名
      root: <root> # 要上传到的目录
      port: [port] # Default is 22
      delete: [true|false] # Default is true
      args: <rsync args>
      verbose: [true|false] # Default is true
      ignore_errors: [true|false] # Default is false
    

    博客园对markdown支持不够友好,原文看这里:http://www.cmlanche.com/2018/06/20/hexo-deployers/

  • 相关阅读:
    FreeBSD 里面用 ADSL 来上网的设置
    功能齐全的DataGrid
    jsp中动态生成图像
    配置Struts应用解读Struts应用的两大配置文件
    spring 事务配置
    文件上传原理简单实现
    html中position两属性relative和absolute区别
    html 窗口参数详解
    hibernate联合主键的使用
    自动投票的一个脚本
  • 原文地址:https://www.cnblogs.com/cmgrass/p/9202058.html
Copyright © 2011-2022 走看看