# NGINX

## Step 1

#### Open the NGINX configuration file

If you are using NGINX’s main configuration file nginx.conf without [virtual hosts](http://ubiq.co/webmaster-blog/configure-multiple-host-names-nginx/), run the following command

```
sudo vi /etc/nginx/nginx.conf
```

If you have configured separate virtual hosts for your website (e.g. [www.example.com](http://www.example.com)), such as /etc/nginx/sites-enabled/example.conf then open its configuration with the following command

```
sudo vi /etc/nginx/sites-enabled/example.conf
```

## Step 2

There are multiple ways to whitelist an IP in NGINX. We will look at each one. If you want to whitelist the IP 45.43.23.21 for a domain or your entire website, you can add the following lines in your configuration file.

```
allow 45.43.23.21;
deny all;
```

The above lines will make NGINX deny all IPs except 45.43.23.21. The first line *allow 45.43.23.21* will allow access from that IP, *deny* all will block all other IPs.

{% content-ref url="/pages/tRFUOl0nfodIMIR6SKyN" %}
[Domain](/configuration-guides/ip-whitelisting/nginx/domain.md)
{% endcontent-ref %}

{% content-ref url="/pages/HvKp06dK6sWwrIzPw49L" %}
[Subdomain](/configuration-guides/ip-whitelisting/nginx/subdomain.md)
{% endcontent-ref %}

{% content-ref url="/pages/J1AbBcxTvDCM5TK0DCTS" %}
[URL](/configuration-guides/ip-whitelisting/nginx/url.md)
{% endcontent-ref %}


---

# 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.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.
