# 部署
[](https://github.com/hexojs/site/edit/master/source/zh-cn/docs/deployment.md "改進本文")
Hexo 提供了快速方便的一鍵部署功能,讓您只需一條命令就能將網站部署到服務器上。
~~~
$ hexo deploy
~~~
在開始之前,您必須先在?`_config.yml`?中修改參數,一個正確的部署配置中至少要有?`type`?參數,例如:
~~~
deploy:
type: git
~~~
您可同時使用多個 deployer,Hexo 會依照順序執行每個 deployer。
~~~
deploy:
- type: git
repo:
- type: heroku
repo:
~~~
## [](https://hexo.io/zh-cn/docs/deployment.html#Git "Git")Git
安裝?[hexo-deployer-git](https://github.com/hexojs/hexo-deployer-git)。
~~~
$ npm install hexo-deployer-git --save
~~~
修改配置。
~~~
deploy:
type: git
repo: <repository url>
branch: [branch]
message: [message]
~~~
| 參數 | 描述 |
| --- | --- |
| `repo` | 庫(Repository)地址 |
| `branch` | 分支名稱。如果您使用的是 GitHub 或 GitCafe 的話,程序會嘗試自動檢測。 |
| `message` | 自定義提交信息 (默認為?`Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}`) |
## [](https://hexo.io/zh-cn/docs/deployment.html#Heroku "Heroku")Heroku
安裝?[hexo-deployer-heroku](https://github.com/hexojs/hexo-deployer-heroku)。
~~~
$ npm install hexo-deployer-heroku --save
~~~
修改配置。
~~~
deploy:
type: heroku
repo: <repository url>
message: [message]
~~~
| 參數 | 描述 |
| --- | --- |
| `repo` | Heroku 庫(Repository)地址 |
| `message` | 自定提交信息 (默認為?`Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}`) |
## [](https://hexo.io/zh-cn/docs/deployment.html#Rsync "Rsync")Rsync
安裝?[hexo-deployer-rsync](https://github.com/hexojs/hexo-deployer-rsync)。
~~~
$ npm install hexo-deployer-rsync --save
~~~
修改配置。
~~~
deploy:
type: rsync
host: <host>
user: <user>
root: <root>
port: [port]
delete: [true|false]
verbose: [true|false]
ignore_errors: [true|false]
~~~
| 參數 | 描述 | 默認值 |
| --- | --- | --- |
| `host` | 遠程主機的地址 | |
| `user` | 使用者名稱 | |
| `root` | 遠程主機的根目錄 | |
| `port` | 端口 | 22 |
| `delete` | 刪除遠程主機上的舊文件 | true |
| `verbose` | 顯示調試信息 | true |
| `ignore_errors` | 忽略錯誤 | false |
## [](https://hexo.io/zh-cn/docs/deployment.html#OpenShift "OpenShift")OpenShift
安裝?[hexo-deployer-openshift](https://github.com/hexojs/hexo-deployer-openshift)。
~~~
$ npm install hexo-deployer-openshift --save
~~~
修改配置。
~~~
deploy:
type: openshift
repo: <repository url>
message: [message]
~~~
| 參數 | 描述 |
| --- | --- |
| `repo` | OpenShift 庫(Repository)地址 |
| `message` | 自定提交信息 (默認為?`Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}`) |
## [](https://hexo.io/zh-cn/docs/deployment.html#FTPSync "FTPSync")FTPSync
安裝?[hexo-deployer-ftpsync](https://github.com/hexojs/hexo-deployer-ftpsync)。
~~~
$ npm install hexo-deployer-ftpsync --save
~~~
修改配置。
~~~
deploy:
type: ftpsync
host: <host>
user: <user>
pass: <password>
remote: [remote]
port: [port]
ignore: [ignore]
connections: [connections]
verbose: [true|false]
~~~
|
| 參數 | 描述 | 默認值 |
| --- | --- | --- |
| `host` | 遠程主機的地址 | |
| `user` | 使用者名稱 | |
| `pass` | 密碼 | |
| `remote` | 遠程主機的根目錄 | `/` |
| `port` | 端口 | 21 |
| `ignore` | 忽略的文件或目錄 | |
| `connections` | 使用的連接數 | 1 |
| `verbose` | 顯示調試信息 | false |
## [](https://hexo.io/zh-cn/docs/deployment.html#其他方法 "其他方法")其他方法
Hexo 生成的所有文件都放在?`public`?文件夾中,您可以將它們復制到您喜歡的地方。