# Problem about rules for deny ips

**URL:** <https://www.ruby-forum.com/t/problem-about-rules-for-deny-ips/220174>\
**Category:** NGINX\
**Created:** [May 31, 2012, 6:18pm UTC](https://www.ruby-forum.com/t/problem-about-rules-for-deny-ips/220174 "2012-05-31T18:18:51Z")\
**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:** [May 31, 2012, 6:18pm UTC](https://www.ruby-forum.com/t/problem-about-rules-for-deny-ips/220174/1 "2012-05-31T18:18:51Z")

</div>

I am trying to configure nginx rules where I allow access only to a  
range of IPs but has a rewrite and does not allow this action anyone  
have any idea how to configure these types of hits?

for example

```
    location /internal {
        root /var/www/folder/app/webroot;
        index index.php;
        if (-f $request_filename) {
            break;
        }
        error_page 500 502 503 504 @error_web;

        # Trigger 503 response on maintenance
        set $maintenance 0;
        if (-f /var/www/folder/.mant) {
            set $maintenance 1;
        }
        if ($remote_addr = 127.0.0.1) {
            set $mant 0;
        }
        if ($maintenance) {
            return 503;
       }
       if (!-f $request_filename) {
            rewrite ^/(.+)$ /index.php?url=$1 last;
            break;
       }
       allow xxx.xxx.xxx.0/24;
        deny all;
    }

```

# – Atte. Pablo Ziga E (+56 9) - 75195192 MSN && Gtalk: removed\_email\_address@domain.invalid | Skype: ed00m\_
