# Subdomain

## Whitelist an IP in NGINX for subdomain

Let’s say you have two subdomains (*blog.example.com* and *articles.example.com*) with their NGINX config files at */etc/nginx/sites-enabled/blog.conf* and */etc/nginx/sites-enabled/articles.conf*

If you want to whitelist an IP in NGINX for only 1 subdomain (e.g. blog.example.com), place the 2 lines below in the blog.conf file of that subdomain

```
sudo vim /etc/nginx/sites-enabled/blog.conf
```

```
server {
  server blog.example.com;
  allow 45.43.23.21;
  deny all;
}
```

If you want to whitelist an IP in both subdomains, then add the 2 lines in both *blog.conf* and *articles.conf* files.

## Restart NGINX

Run the following command to check the syntax of your updated config file.

```
sudo nginx -t
```

If there are no errors, run the following command to restart the NGINX server.

```
sudo systemctl restart nginx
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.goodaccess.com/configuration-guides/ip-whitelisting/nginx/subdomain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
