# Dynamic IP Whitelisting From A Database

**URL:** <https://www.ruby-forum.com/t/dynamic-ip-whitelisting-from-a-database/223711>\
**Category:** NGINX\
**Created:** [October 15, 2012, 7:56am UTC](https://www.ruby-forum.com/t/dynamic-ip-whitelisting-from-a-database/223711 "2012-10-15T07:56:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 15, 2012, 7:56am UTC](https://www.ruby-forum.com/t/dynamic-ip-whitelisting-from-a-database/223711/1 "2012-10-15T07:56:57Z")

</div>

Hi,

We have a software as a service product where each user get’s their own  
hosted subdomain like ([me.domain.com](http://me.domain.com)). We would like to implement  
whitelisting, where users can specify certain IP addresses that are  
allowed  
to view their site. This is implemented like:

location / {  
allow 1.2.3.4;  
allow 2.3.4.5;  
deny all;  
}

The problem is that we don’t want to deal with the application code  
touching/writing the nginx configuration when a user makes changes to  
the  
whitelist. I was thinking it would be awesome if nginx could read this  
from  
a database (MySQL or SQLite), and auto populate the allow list from  
that. Is  
this possible? If not, what is the best way to implement whitelisting,  
without the application code reading and writing the nginx configuration  
file.

Posted at Nginx Forum:

> **[Dynamic IP Whitelisting From A Database](https://forum.nginx.org/read.php?2,231793,231793#msg-231793)**
>
> Hi, We have a software as a service product where each user get's their own hosted subdomain like (me.domain.com). We would like to implement whitelisting, where users can specify certain IP addresses that are allowed to view their site. This is...
