# Nuxt Site佈署
# 可用屬性
- env(optional): Object, 佈署指令將會把此env物件設定到src/config/env.json, 當前端一些設定需要依照不同佈署設定來調整的時候, env屬性將是一個很好的選擇
- vuePublicFolderPath(optional): String, nuxt專案的public目錄(root)名稱, 使用預設為
static
- build:
- clientBuildScript(optional): 當
nuxt.target
設定為static
時有作用, client端的打包指令, 預設為yarn generate
- serverBuildScript(optional): 當
nuxt.target
設定為server
時有作用, server端的打包指令, 預設為yarn build
- clientBuildScript(optional): 當
- nuxt(required): Object, nuxt專用設定, 詳見下方
nuxt設定
段落
# nuxt設定
- target(required):
nuxt target
, 可用值為server
或static
- pm2AppName(optional):
nuxt target
為server
時, 需要透過pm2
啟動nuxt
, 這個設定為該pm2
的process name
, 預設為nuxt-site
- port(optional):
nuxt start
啟動的port
, 預設為8888
- buildAtClient(optional): 在client端打包前端, 優點是可以將打包的負載轉嫁到執行發佈client端, 缺點是
rsync
的檔案數量非常多
# rsync屬性額外子屬性
- removeRemoteBeforeRsync: Boolean, rsync之前刪除遠端目錄
# deploy(Single Server)
若不使用SSL, 可不使用
ssl
及
參數
- port(required): String, 內部Proxy Port
- proxyPort: String, 要轉接的外部Port(預設為80)
- domain(required): String, 網域, 如果是本機請使用localhost
- ssl: Boolean, 使用SSL
- email: String, Let's encrypt email
- filename(required): String, 存在/etc/nginx/sites-available/中的檔名, 例如: site.conf
hyper-rocket nginx:nuxt \
--ssl \
--spa \
--filename [domain].conf \
--path /home/site/project/[project-name]/frontend \
--domain [domain] \
--email [email]
# deploy(Multi Server)
基本上同Single Server
佈署方式
只要將host
改為localhost
並不要使用ssl
及email
選項即可
hyper-rocket nginx:nuxt \
--ssl \
--spa \
--filename [domain].conf \
--path /home/site/project/[project-name]/frontend \
--domain [domain] \
--email [email]
← Vue Site佈署 Laravel佈署 →