Enabling IP access control via Nginx

In addition to protecting your application (or parts of it) using HTTP basic authentication, you can use Cloud 66 CustomConfig to block (or allow) access to your application based on IP addresses.

Follow the instructions below to accomplish this.

  1. Create a file in the root of your repository called blockips.conf. This file will contain the IPs you wish to allow/deny.
  2. To deny a single IP address, you can use the following syntax:

    You can also deny an entire subnet as follows:


    Should you wish to only allow access to your IP address, do this:

    allow; deny all;

    There are lots of resources about this syntax on the Internet in case you need more guidance.

  3. Now we can go ahead and customize the Nginx configuration, which you can see more about in our Nginx CustomConfig documentation.

    You will want to add the following code within the http section of your configuration, for example on line 22.

    include {{ deploy_to }}/current/blockips.conf;

    This will read the file from your repository directory on the server. Once you save that configuration, it will apply immediately on your server.