12
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ZEIT NOWにNuxtをデプロイする

Posted at

概要

色んな経緯があって友人のお店のWebサイトを改修することになった。
Nuxtで作成されたWebサイトをZeit Nowにデプロイする方法をメモ代わりに残しておく

前提

Nuxt 2.8.0

参考サイト

now-builder
Nowの日本語手順

デプロイ手順

1. rootディレクトリにnow.jsonを作成し、下記のように記載する

now.json
{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/now-builder",
      "config": {}
    }
  ]
}

2. Now CLIをインストール

npm install -g now

3. Zeitアカウント作成

ここで作成する

4. NowCLIでログインする

$ now login
> We sent an email to XXXXXX@gmail.com. Please follow the steps provided
  inside it and make sure the security code matches Valuable Tasmanian Devil.
✔ Email confirmed
> Ready! Authentication token and personal details saved in "~/.now"

5. Nowにデプロイする

$ now
> Deploying ~/dev/maynewyork under mh52124
> Using project maynewyork
> Synced 6 files (437.46KB) [2s]
> https://XXXXX-XXXXXXX.now.sh [v2] [991ms]
> Ready! Deployed to https://XXXXX.XXXXXXX.now.sh [in clipboard] [2m]

これだけでWebサイトを公開できたので非常にかんたん

補足

Github連携

Zeit NowのアカウントページのSettingで連携の設定を行う

指定のリポジトリを設定してあげれば、masterブランチにpushされた時点で自動でデプロイしてくれる!!
かなりかんたんで便利

独自ドメイン

独自のドメイン設定するには下記のコマンドでできるらしい

now domains add □□□.com

実行したら下記のメッセージが出てきたのでその通りにやったら独自ドメインの反映も完了

> Success! Domain meynewyork.com added correctly. [3s]

> WARN! The domain was added but it is not verified. To verify it, you should either:
  a) Change your domain nameservers to the following intended set: [recommended]

     Intended Nameservers    Current Nameservers
     a.zeit-world.co.uk      b.zeit-world.co.uk     ✘
     d.zeit-world.org        d.zeit-world.org       ✔
     e.zeit-world.net        e.zeit-world.com       ✘
     f.zeit-world.com        f.zeit-world.net       ✘

  b) Add a DNS TXT record with the name and value shown below.

     name        type        value
     _now        TXT         QmUXnkuCvQecaRGLn3wHHaSpDBLw282LaUArVw5r334QEx

  We will run a verification for you and you will receive an email upon completion.
  If you want to force running a verification, you can run `now domains verify <domain>`
  Read more: https://err.sh/now-cli/domain-verification

12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?