# Deploying the Nuts-node in your environment

Deploy the Nuts Node and configure your network to make it work as it should

# Deploy Nuts-node

# Scenario if you want to use Nuts-node (default)
deploy Nuts-node using 

# Scenario if you want to use Knooppunt
You could use this [deployment guide](https://github.com/nuts-foundation/nuts-knooppunt/blob/main/DEPLOYMENT.md) and/or [this docker-compose file](https://github.com/nuts-foundation/nuts-knooppunt/blob/main/docker-compose.yml).

# Deploy admin app

deploy Nuts-admin-app: https://github.com/nuts-foundation/nuts-admin

# Configure url rewrite for OAuth

At Nuts uses the RFC8615 spec for .well-known URIs (https://www.rfc-editor.org/rfc/rfc8615.html). This means well-known resources, like the OAuth server, are resolved from the root of the (sub)domain. If you host the Nuts node on a subpath, you need to do some URL rewriting.

On Azure Application Gateway, it would look something like this (given your Nuts node runs on /nuts):

```
   // Route well-known endpoints to Nuts node
        // The URL:
        //    https://<host>/.well-known/oauth-authorization-server/nuts/oauth2/<subject-id>
        // should map to:
        //    /.well-known/oauth-authorization-server/oauth2/<subject-id>
        path: '/.well-known/oauth-authorization-server/nuts'
        rewriteCondition: '/.well-known/oauth-authorization-server/nuts(.*)'
        rewriteRule: '/.well-known/oauth-authorization-server{var_uri_path_1}'
```