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

# NGINX Plus

> このチュートリアルでは、nginx-openid-connect モジュールを使用して、NGINX サーバーに認証および認可を追加する方法を紹介します。

このチュートリアルでは、`nginx-openid-connect` モジュールを使用して、NGINX サーバーに認証および認可を追加する方法を説明します。アカウント用に設定された例でこのクイックスタートを進められるよう、事前にログインしておくことをお勧めします。

###

このチュートリアルとシードプロジェクトは、以下の環境でテストされています。

* NGINX Plus R24

###

まず、NGINX Plus 用の `nginx-plus-module-njs` モジュールをインストールする必要があります。

動的モジュールのインストールガイドに従って、ホスト OS にパッケージをインストールしてください。

`yum` パッケージマネージャーを使用する Linux ディストリビューションでは、次のようにモジュールをインストールできます。

```sh lines theme={null}
sudo yum install nginx-plus-module-njs jq
```

インストールしたら、次の行を
`/etc/nginx/nginx.conf` ファイルの先頭付近に追加して、NGINX で有効にする必要があります。

```sh lines theme={null}
load_module modules/ngx_http_js_module.so;
```

###

`nginx-openid-connect` リポジトリをクローンします。このリポジトリには、テンプレート設定が含まれています。

```sh lines theme={null}
git clone https://github.com/nginxinc/nginx-openid-connect
```

###

nginx-openid-connect フォルダー内で configure.sh スクリプトを実行し、
Auth0 アプリケーション用のテンプレート設定を反映させます。

```sh lines theme={null}
./configure.sh --auth_jwt_key request \
--client_id {yourClientId} \
--pkce_enable \
https://{yourDomain}/.well-known/openid-configuration
```

次に、[テナントのログアウト URL](/docs/docs/ja-jp/api/authentication#auth0-logout) を
`openid_connect_configuration.conf` ファイルに追加します。

###

`openid_connect.server_conf` ファイルに `Accept-Encoding` ヘッダーを追加し、
値を `gzip` に設定します。

###

4 つの設定ファイルを `conf.d` フォルダーにコピーします。

```sh lines theme={null}
sudo cp openid_connect.js \ 
frontend.conf \
openid_connect_configuration.conf \
openid_connect.server_conf /etc/nginx/conf.d
```

###

Auth0 Dashboard で、次の操作を行います。

1. **アプリケーション** > **アプリケーション** に移動し、一覧から対象のアプリケーションを選択します。
2. **設定** ビューに切り替えます。
3. **Application URIs** セクションで、`https://{yourDomain}/_codexch`
   を **Allowed Callback URLs** に追加します。
4. **資格情報** ビューに切り替えます。

**Application Authentication** セクションで、**Authentication Method** を None に設定します。

###

`/etc/nginx/conf.d/frontend.conf` ファイルで、ID トークン (JWT) から取得した追加のヘッダーを
アップストリームの宛先に渡します。

## 次のステップ

すばらしいです！ここまで完了していれば、アプリケーションでログイン、ログアウト、ユーザープロファイル情報が利用できるようになっているはずです。

これでクイックスタートチュートリアルは終了ですが、まだまだ活用の幅は広がります。Auth0 でできることをさらに知りたい場合は、次をご覧ください。

* [Auth0 Dashboard](https://manage.auth0.com/dashboard/us/dev-gja8kxz4ndtex3rq) - Auth0 テナントとアプリケーションの設定および管理方法を学ぶ
* [Auth0 Marketplace](https://marketplace.auth0.com/) - Auth0 の機能を拡張するために有効化できる連携を確認する
