版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。 https://blog.csdn.net/weixin_40254498/article/details/82426050
ZEIT.CO
- 您可以輕松,快速,可靠地将JavaScript(Node.js)或Docker支援的網站,應用程式和服務帶到雲端。實際上,任何包含package.json或Dockerfile可以使用一個指令傳輸到雲的目錄:now。
- 每次部署項目時,現在都會為您提供一個新的唯一URL(甚至在上傳完成之前)。這些URL看起來像這樣(為您自動确定應用程式的名稱): 。在将部署投入生産時,您隻需選擇适當的别名(自定義域)。my-app my-app-erkgfjtrna.now.sh
簡單部署
(我是用windows10 系統)
下載下傳推薦使用的用戶端 ,在macOS,Windows和Linux上通過npm或作為預先建構的二進制檔案提供。但是,推薦的安裝機制是Now Desktop(包括Now CLI,并確定它始終是最新的)。
将自己寫好的靜态網頁放在一個檔案夾裡。
# .\now-win.exe .\public\
PS E:\hexo\hexoblog> .\now-win.exe .\public\
> UPDATE AVAILABLE The latest version of Now CLI is 11.4.1
> Read more about how to update here: https://zeit.co/update-cli
> Deploying E:\hexo\hexoblog\public under pzwdshxzt
> Your deployment's code and logs will be publicly accessible because you are subscribed to the OSS plan.
> NOTE: You can use `now --public` or upgrade your plan (https://zeit.co/account/plan) to skip this prompt
> Synced 70 files (1.57MB) [12s]
> https://public-ehzfoxryxi.now.sh [in clipboard] [2s]
> Deployment complete!
看到這裡就表示成功了。
每次部署都會是不一樣的域名,域名也不是很好記,但是你可以用自己的域名部署上去。
删除部署
需要删除已經廢棄的部署呢,也很簡單
rm 指令可以删除
PS E:\hexo\hexoblog> .\now-win.exe rm https://public-athxetfvht.now.sh
> UPDATE AVAILABLE The latest version of Now CLI is 11.4.1
> Read more about how to update here: https://zeit.co/update-cli
> Found 1 deployment for removal in pzwdshxzt [1s]
> The following 1 deployment will be permanently removed:
P4XeN5ZnH7skCRzvz4sa0piS https://public-athxetfvht.now.sh 1m ago
> Are you sure? [y/N] y
> Success! 1 deployment removed [550ms]
- public-athxetfvht.now.sh
替換域名
使用 alias 将制定的部署包替換成 自己的域名
PS E:\hexo\hexoblog> .\now-win.exe alias https://public-fmqneyczqv.now.sh blog.dwxqnswxl.cn
> UPDATE AVAILABLE The latest version of Now CLI is 11.4.1
> Read more about how to update here: https://zeit.co/update-cli
> Assigning alias blog.dwxqnswxl.cn to deployment public-fmqneyczqv.now.sh
> Nameservers: f1g1ns1.dnspod.net, f1g1ns2.dnspod.net
> Error! We couldn't verify the domain dwxqnswxl.cn.
Please make sure that your nameservers point to zeit.world.
Examples: (full list at https://zeit.world)
a.zeit.world 96.45.80.1
b.zeit.world 46.31.236.1
c.zeit.world 43.247.170.1
As an alternative, you can add following records to your DNS settings:
name type value
_now TXT a5bddbba39391c47c4d754069f1442d136a1dca94680a56f007231732c1b1932
ALIAS alias.zeit.co
第一次失敗了,體會提示你在你的域名解析該怎麼填寫,如上最後兩行;
然後再域名解析中添加就好了
然後再試下,就好了
PS E:\hexo\hexoblog> .\now-win.exe alias https://public-fmqneyczqv.now.sh blog.dwxqnswxl.cn
> UPDATE AVAILABLE The latest version of Now CLI is 11.4.1
> Read more about how to update here: https://zeit.co/update-cli
> Assigning alias blog.dwxqnswxl.cn to deployment public-fmqneyczqv.now.sh
> Certificate for blog.dwxqnswxl.cn (cert_aaGncmbkE1U2BhE) created [18s]
> Success! blog.dwxqnswxl.cn now points to public-fmqneyczqv.now.sh [21s]
Docker部署
常用指令
指令 | 描述 |
---|---|
now [path] … | 調用時now,目前目錄中的檔案将上載到Now,并将建立新的部署。之後,您将立即收到其網址,以便與全球其他人分享。該[path]可以是一個檔案(導緻靜态部署)或目錄(部署類型将根據内容來确定)。如果要一次部署多個路徑,請閱讀此内容。 |
now ls|list [app] | 顯示所有部署的清單。如果[app]已定義,則僅列出該命名空間下的部署。 |
now rm|remove [id] | 從我們的平台中删除部署。該[id]參數可以是部署(例如網址 https://static-ytbbrhoggd.now.sh 或主機名(例如static-ytbbrhoggd.now.sh)。 |
now ln|alias [id] [url] | 我們為您配置現有部署的别名。您可以在此處閱讀有關如何從此子指令中擷取最多功能的更多資訊。 |
now domains [name] | 允許您直接從指令行管理域名(在将它們用作别名之前)。 |
now certs [cmd] | 預設情況下,Now将自動為您的部署配置證書。使用此子指令,您可以看到它們何時到期并上傳您自己的子指令 |
and so on |