From: Ruben Beltran del Rio Date: Tue, 6 Feb 2024 19:42:52 +0000 (+0100) Subject: Add nginx_office_hours page X-Git-Url: https://git.r.bdr.sh/rbdr/r.bdr.sh/commitdiff_plain/96aeed1c9a07d8871519550b6d7eec5cc712051b?ds=sidebyside;hp=6b7f16757157c4e99c9764ee715832e7e838715b Add nginx_office_hours page --- diff --git a/index.gmi b/index.gmi index 7bc49e1..459440c 100644 --- a/index.gmi +++ b/index.gmi @@ -96,7 +96,7 @@ Older versions of the plugin exist for other editors, though they support an old ### NGINX Office Hours A victory for the server's labor rights: An nginx module that allows you to serve your content only during office hours. -=> https://git.unlimited.pizza/rbdr/ngx_http_office_hours_filter_module ngx_http_office_hours_filter_module +=> ./nginx_office_hours.gmi ./nginx_office_hours.gmi ### Junction A browser extension that lets you start audio calls on any URL. diff --git a/nginx_office_hours.gmi b/nginx_office_hours.gmi new file mode 100644 index 0000000..9286023 --- /dev/null +++ b/nginx_office_hours.gmi @@ -0,0 +1,87 @@ +--- title: /nginx_office_hours.html +--- description: A victory for the server's labor rights: An nginx module that allows you to serve your content only during the server's office hours. +## NGINX Office Hours Module + +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. + +=> https://git.unlimited.pizza/rbdr/ngx_http_office_hours_filter_module view source @ git.unlimited.pizza +=> https://git.sr.ht/~rbdr/ngx_http_office_hours_filter_module source mirror @ sourcehut + +## Install + +### From Source + +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 +``` + +=> https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#compiling-and-installing-from-source [1] Compiling And Installing NGINX from Source + +## The office_hours directive + +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] + +=> /closed.html [2] A page that is never open. + +### Example 1: Open 24 hours + +Don't use this directive. + +### Example 2: Open every day from 08:30 AM to 7:00 PM + +``` +location / { + office_hours 8:30-19; +} +``` + +### Example 3: Open monday to saturday from 08:30 AM to 7:00 PM, but closed sundays + +``` +location / { + office_hours 8:30-19 closed; +} +``` + +### Example 4: Open weekdays from 08:30 AM to 7:00 PM, Saturdays 10:00 AM to 4:00 PM, closed on sundays + +``` +location / { + office_hours 8:30-19 10-16 closed; +} +``` + +### Example 5: Open weekdays from 08:30 AM to 7:00 PM, closed on thursdays, reduced hours on weekends. + +``` +location / { + office_hours 8:30-19 closed 8:30-19 10-16 10-16; +} +``` + +### Example 6: Closed every day. + +Uninstall nginx. + +## The office_hours_additional_information directive + +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 "

Additional Information>

+

Please do not email us asking to open the website 24/7. Send all complaints to friendship.quest/@ruben

" +} +``` diff --git a/page.gmi b/page.gmi index 656c170..5e644ab 100644 --- a/page.gmi +++ b/page.gmi @@ -4,7 +4,8 @@ Command line tool to generate a static website and gemini capsule from a directory with gemtext. Written in rust! -=> https://git.unlimited.pizza/rbdr/page view source. +=> https://git.unlimited.pizza/rbdr/page view source @ git.unlimited.pizza +=> https://git.sr.ht/~rbdr/page source mirror @ sourcehut ## Install