How can we help?

Whitlist UptimeMonster IPs in Nginx

To allow IPv6 and IPv4 addresses in Nginx, you’ll need to modify your Nginx configuration file appropriately. Here’s how you can allow the UptimeMonster IP addresses 2a01:4f8:c012:9c4a::1 (IPv6) and 162.55.41.109 (IPv4):

1. Access the Nginx Configuration File

Open your Nginx configuration file using a text editor. This could be the main nginx.conf file or a specific site configuration file under /etc/nginx/sites-available/.

sudo nano /etc/nginx/nginx.conf

Or for a specific site configuration file:

sudo nano /etc/nginx/sites-available/your-site.conf

2. Add IP Allow Rules

Within the appropriate server block or location block in your configuration file, add the allow directives for the specified IPv6 and IPv4 addresses.

server {
    listen 80;
    server_name your-domain.com;

    location / {
        # Allow specific IPv6 address
        allow 2a01:4f8:c012:9c4a::1;

        # Allow specific IPv4 address
        allow 162.55.41.109;

        # Deny all other IP addresses
        deny all;

        # Your other location directives
        try_files $uri $uri/ =404;
    }
}

3. Save and Close the Configuration File

After adding the allow directives for the IP addresses, save the changes and close the editor. In nano, press CTRL + X, then Y to confirm, and Enter to save.

4. Test the Nginx Configuration

It’s important to check the syntax of your Nginx configuration files to ensure there are no errors:

sudo nginx -t

If the test is successful, you should see a message indicating that the configuration file test is successful.

5. Reload Nginx to Apply Changes

Finally, reload Nginx to apply the new configuration:

sudo systemctl reload nginx

Or, for older systems using init.d:

sudo service nginx reload

Was this article helpful to you?

How can we help?

Unavailable Item Is Unavailable Available Item Is Available