Skip to content

Commit 60557cc

Browse files
authored
Merge pull request #5 from adamjakab/nginx-docs
Nginx docs update
2 parents 56705c3 + f91107f commit 60557cc

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

Examples/Nginx/README.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,37 @@
22

33
## Implementation
44

5-
NOTE: The following implementation steps have been developed and tested using this [Docker image](https://github.com/fabiocicerchia/nginx-lua).
5+
NOTES:
6+
- The following implementation steps have been developed and tested using this [Docker image](https://github.com/fabiocicerchia/nginx-lua).
7+
- The following example uses `./usr/queueit` as the base path for storing all the Queue-it related files. Review and modify it to your needs.
68

7-
Copy [KnownUserNginxHandler.lua](https://github.com/queueit/KnownUser.V3.Lua/blob/master/Handlers/KnownUserNginxHandler.lua) and folders ([SDK](https://github.com/queueit/KnownUser.V3.Lua/tree/master/SDK) and [Helpers](https://github.com/queueit/KnownUser.V3.Lua/tree/master/Helpers)) incl. their content to your NGINX filesystem (in the following example we have added it to `usr/queueit`).
89

9-
Then update/add `lua_package_path` in your `nginx.conf` to include the new path (keep `;;` in the end which means default path):
10+
### 1. Copy the necessary files to your NGINX filesystem
11+
12+
Copy the following two folders from this repository to your NGINX filesystem:
13+
- [SDK](../../SDK) -> `./usr/queueit/SDK`
14+
- [Helpers](../../Helpers) -> `./usr/queueit/Helpers`
15+
16+
Copy the main handler script:
17+
18+
- [Handlers/KnownUserNginxHandler.lua](../../Handlers/KnownUserNginxHandler.lua) -> `./usr/queueit/KnownUserNginxHandler.lua`
19+
20+
21+
### 2. Update the package paths
22+
23+
Update or add the `lua_package_path` configuration option in the `http` section of your main configuration file (typically `nginx.conf`) to include the new paths you created in Step 1. Make sure to keep `;;` in the end which means default path:
1024

1125
```
1226
http {
1327
lua_package_path "./usr/queueit/?.lua;./usr/queueit/SDK/?.lua;./usr/queueit/Helpers/?/?.lua;;";
1428
}
1529
```
1630

17-
Then update `conf.d/default.conf`:
31+
32+
### 3. Add the Queue-it handler to a specific location
33+
34+
Update the configuration file relative to the location you want to be protected by Queue-it (`conf.d/default.conf` or similar):
35+
1836
```
1937
server {
2038
location / {
@@ -44,15 +62,21 @@ server {
4462
}
4563
}
4664
```
47-
In this example `rewrite_by_lua_block` have been added to default location `/` but you must decide what makes sense in your case.
48-
Especially excluding any static content you don't want queue-it protection triggering on. This could be images (.png, .jpg), style (.css) and pages (.html).
4965

50-
Please note the comments in the code about providing `integrationconfig.json` ([read more](https://github.com/queueit/KnownUser.V3.Lua#1-providing-the-queue-configuration)) and replacing `CUSTOMER_ID` and `SECRET_KEY` with correct credentials located in GO Queue-it platform.
66+
Replace the following two placeholders in the above code `{CUSTOMER_ID}` and `{SECRET_KEY}` with respective values located in GO Queue-it platform.
67+
68+
NOTE: In this example `rewrite_by_lua_block` directive was added to default location `/` but you must decide what makes sense in your case. In the specific, excluding any static content you don't want queue-it protection triggering on. This could be images (.png, .jpg), style sheets (.css) and pages (.html).
69+
70+
71+
### 4) Provide the configuration file
5172

52-
### Request body trigger (advanced)
53-
Nginx handler (incl. Lua SDK) supports triggering on request body content. Example could be a POST call with specific item ID where you want end-users to queue up for.
54-
You will need to contact queue-it support if this functionality is needed, so it can be enabled on your GO Queue-it platform account.
55-
When enabled you also need to add extra settings to `location` in `conf.d/default.conf`:
73+
The above code requires you to provide the `integrationconfig.json` file which contains the configuration you create on the Queue-it GO platform ([more info here](../../README.md#1-providing-the-queue-configuration)). There are various ways to provide this file. Please read the [specific documentation here](../../Documentation/README.md).
74+
75+
76+
## Request body trigger (advanced)
77+
The Nginx handler (incl. Lua SDK) supports triggering on request body content. An example could be a POST call with specific item ID where you want end-users to queue up for.
78+
For this to work, you will need to contact queue-it support, so it can be enabled on your GO Queue-it platform account.
79+
Once enabled, you will need to add these extra settings to your configuration:
5680

5781
```
5882
location / {
@@ -65,4 +89,3 @@ location / {
6589
...
6690
}
6791
```
68-

0 commit comments

Comments
 (0)