💾 Archived View for r.bdr.sh › nginx_office_hours.gmi captured on 2024-05-12 at 14:53:18. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-03-21)
-=-=-=-=-=-=-
Or ngx_http_office_hours_filter_module for short, it's a module for nginx that lets you specify a schedule and only serve content during that time.
You can install it from source:
1. Clone nginx source to a directory
2. Clone ngx_http_office_hours_filter_module to another directory
3. Build NGINX as you usually would[1], appending the option for this dynamic module:
./configure --add-dynamic-module=/path/to/ngx_http_office_hours_filter_module make sudo make install
[1] Compiling And Installing NGINX from Source
The office_hours directive expects a list of time ranges separated by spaces in the format: "HH:mm-HH:mm". The hours should be in 24 hour format, and the minutes are optional. The word "closed" can be used to indicate that the server is not operating on that day.
The first range will be used as the default value, and the rest will be read from right to left, starting with sunday.
When the current time is within those hours, the server will operate as usual, otherwise it will return a 403 with a page showing the operating hours of the service. See this example for a page that's always closed[2]
[2] A page that is never open.
Don't use this directive.
location / { office_hours 8:30-19; }
location / { office_hours 8:30-19 closed; }
location / { office_hours 8:30-19 10-16 closed; }
location / { office_hours 8:30-19 closed 8:30-19 10-16 10-16; }
Uninstall nginx.
With this directive you can specify additional information for when the server is closed, such as contact information or alternate locations for the data. It accepts a text containing HTML that will be injected to the body of the office hours page.
location / { office_hours_additional_information "<h1>Additional Information></h1> <p>Please do not email us asking to open the website 24/7. Send all complaints to friendship.quest/@ruben</p>" }