3 A victory for the server's labor rights: An nginx module that allows you to serve your content only during office hours.
7 The `office_hours` directive expects a list of time ranges separated by
8 spaces. The first range will be used as the default, and the rest will
9 be read from right to left, ending with *sunday*
11 ### Example 1: Open 24 hours
13 Don't use this directive.
15 ### Example 2: Open every day from 08:30 AM to 7:00 PM
21 Some things worth noting here: the format of time ranges uses 24 hour
22 style, so no pesky AMs or PMs. Likewise, minutes are optional. Finally,
23 note that since only one range was defined, this is applied to all days
24 of the week. Another noteworthy
26 ### Example 3: Open every day from 08:30 AM to 7:00 PM, but closed sundays
29 office_hours 8:30-19 closed;
32 Two important things here: first notice that the closed keyword
33 specifies that the server is closed on a specific day; second, notice
34 how the last element is used for sunday, while the first one still
35 applies to Monday-Saturday.
37 ### Example 4: Open weekdays from 08:30 AM to 7:00 PM, Saturdays 10:00 AM to 4:00 PM, closed on sundays
40 office_hours 8:30-19 10-16 closed;
43 Now hopefully you can see the pattern: The first time range applies to
44 Monday-Friday, next one to Saturday and last one to Sunday.
46 ### Example 5: Open weekdays from 08:30 AM to 7:00 PM, closed on thursdays, reduced hours on weekends.
49 office_hours 8:30-19 closed 8:30-19 10-16 10-16;
52 Since we had to specify from Thursday, we have to explicitly set the
53 values for Friday, Saturday and Sunday.
55 ### Example 6: Closed every day.
59 ## What you will need to get started
61 * [astyle][astyle]: Used to format the code
62 * An `nginx` [source distribution][nginx] to compile the code.
63 * A way to compile `nginx`. Check out [their guide][nginx-guide]!
65 ## Building the module
67 You can build office hours as a dynamic module. From the `nginx` source
71 ./configure --add-dynamic-module=/path/to/ngx_http_office_hours_filter_module
75 For more information check the [nginx docs][nginx-module-docs]
77 ## Installing git hooks
79 This repo contains a pre-commit git hook so indent will run before every
80 commit. Run `make setup_hooks` to install it.
82 ## Further Improvements
84 * Add support for timezones (currently only GMT)
85 * Add support for public holidays
86 * Add support to respect the time zone of the visitor and not just the
88 * Add support for double shifts in the same day
90 [astyle]: http://astyle.sourceforge.net
91 [nginx]: https://nginx.org/en/download.html
92 [nginx-guide]: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#sources
93 [nginx-module-docs]: https://www.nginx.com/resources/wiki/extending/