Wizard
Wizard

Reputation: 11265

access permissions in nginx config

I have system structure like /var/www/system

What I want: allow to access to /system/ only from 10 ips, but /system/bills can access anyone ?

This is possible to do with nginx, my virtual machine is run on Centos.

Upvotes: 0

Views: 58

Answers (1)

Brian Bowles
Brian Bowles

Reputation: 331

It is possible. In your server config you will just need separate location blocks for each.

For example if your server block has a root /var/www already defined then:

location /system {
    allow 192.168.1.1;
    allow 192.168.1.2;
    allow ...
    deny all;
}

location /system/bills {
    allow all;
}

Upvotes: 2

Related Questions