Help us understand the problem. What is going on with this article?

ZEIT NOWにNuxtをデプロイする

概要

色んな経緯があって友人のお店の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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした