> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI でカスタムドメインを設定する

> ターミナルから Square Cloud の Web サイトにカスタムドメインを設定し、作成する DNS レコードを確認して、アカウントのドメインと共有ドメインを一覧表示します。

カスタムドメインの設定は 2 ステップです。`app network domain` でアプリケーションにドメインを設定し、`app network dns` が表示する DNS レコードを DNS プロバイダーで作成します。ヘルプセンターには[カスタムドメインの手順ガイド](https://help.squarecloud.app/en-us/article/how-to-set-up-your-own-domain-cnamedns-1fzbrgh/)と、[ドメインの反映に時間がかかる理由](https://help.squarecloud.app/en-us/article/why-hasnt-my-domain-propagated-yet-dns-f5jzoy/)の説明があります。

`[appID]` と `--app` は省略できます。[CLI がアプリを特定する仕組み](/ja/cli-reference/quickstart#cli-がアプリを特定する仕組み)を参照してください。

## `squarecloud app network domain`

```bash 使い方 theme={"system"}
squarecloud app network domain <hostname> [--app <appID>]
```

アプリケーションのカスタムドメインを設定し、以前のドメインを置き換えます。カスタムドメインは Standard、Pro、Enterprise プランで利用できます。カスタムドメインを削除するには、ホスト名として `@` を渡します。

```bash theme={"system"}
squarecloud app network domain www.example.com
```

```bash 出力 theme={"system"}
✓ Custom domain www.example.com configured successfully
Run 'squarecloud app network dns' to see the DNS records you need to create.
```

## `squarecloud app network dns`

```bash 使い方 theme={"system"}
squarecloud app network dns [appID] [--json]
```

カスタムドメイン用に作成する DNS レコードを、それぞれの種類、名前、値、ステータスとともに表示します。カスタムドメインがない場合は、先に設定するよう案内が表示されます。

## `squarecloud app domains`

```bash 使い方 theme={"system"}
squarecloud app domains [--json]
```

すべてのアプリケーションに設定されているドメインを、ホスト名、種類、所有するアプリケーションの ID とともに一覧表示します。

## `squarecloud app load-balancers`

```bash 使い方 theme={"system"}
squarecloud app load-balancers [--json]
```

**エイリアス:** `lb`

複数のアプリケーションに設定されているカスタムドメイン（ロードバランサー）をホスト名ごとにまとめ、そのドメインを共有する各アプリケーションの ID、名前、クラスターとともに一覧表示します。先頭には、プランで 1 つのドメインに設定できるアプリケーション数が表示されます。

```bash theme={"system"}
squarecloud app lb --json
# Prints the raw load balancer list as JSON.
```

## 関連項目

| コマンド | API | JavaScript SDK |
| - | - | - |
| `network domain` | [`POST .../network/custom`](/ja/api-reference/endpoint/apps/network/custom) | [`api.apps.network.setDomain()`](/ja/sdks/js/network) |
| `network dns` | [`GET .../network/dns`](/ja/api-reference/endpoint/apps/network/dns) | [`api.apps.network.dns()`](/ja/sdks/js/network) |
| `domains` | [`GET /v2/apps/domains`](/ja/api-reference/endpoint/apps/domains) | [`api.apps.domains()`](/ja/sdks/js/managing_application) |
| `load-balancers` | [`GET /v2/apps/load-balancers`](/ja/api-reference/endpoint/apps/network/load-balancers) | [`api.apps.loadBalancers()`](/ja/sdks/js/managing_application) |

Web サイトのトラフィック、エラー、キャッシュについては[エッジアナリティクス](/ja/cli-reference/edge-analytics)を参照してください。
