Welcome! Log In Create A New Profile

Advanced

RE: is nginx support time-based acl?

Reinis Rozitis
June 01, 2019 07:52AM
> hi all, I have a Nginx server,which I want to setup a time-based acl, for example,
> during 8am to 17pm, Nginx accept all connections, during 17pm to 8am nextday,
> Nginx deny all connections.
> Different acl may be deployed in different sites.
>
> Is this possible? I looked at the ngx_http_access_module, seems cannot do this.

Besides auth request or some lua module depending on the complexity of the acl you could just use crontab for that:
- in nginx.conf in particular site/server block add: include deny.conf; (each site can have its own config)
- in crontab at 17pm do: echo 'deny all;' > deny.conf; nginx -s reload
- at 8am: echo '' > deny.conf; nginx -s reload

(or if the rules are more complex you can just write those down in a pre-made file and then in the crontab just swap those and do a reload)

rr

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

is nginx support time-based acl?

baalchina May 31, 2019 09:48PM

Re: is nginx support time-based acl?

Aleksandar Lazic June 01, 2019 05:20AM

RE: is nginx support time-based acl?

Reinis Rozitis June 01, 2019 07:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 158
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready