0 # PoW Shield
1
2 A nginx module to add a proof-of-work challenge before accessing a page.
3
4 ![pic0](./img/img.webp)
5
6 ## Build
7
8 To build this module you will need to download nginx source code first.
9 Clone Pow Shield repository outside of the nginx source folder.
10 In the nginx source code directory uses the command :
11
12 ./auto/configure --add-dynamic-module=[absolute path to PoW-Shield repo]
13
14 This will build PoW Shield as a dynamically loadable module.
15 If you want to build the module for a pre-compiled nginx server, you will need
16 to get the source code of the same version as the pre-built nginx.
17 You will also need to compile it with the same flags. To see with which flags
18 a nginx binary was built with, use the command 'nginx -V'.
19
20 ## Configuration
21
22 In your nginx configuration file, add 'powshield "on";' to a server or a location.
23 The protection can also be disabled for specific URLs with 'powshield "off";'
24
25 ```nginx
26 server {
27 listen 80;
28 server_name localhost;
29
30 root html;
31
32 powshield "restricted";
33 location /static {
34 powshield off;
35 }
36
37 location / {
38 index index.html index.htm;
39 }
40 }
41 ```
42
43 If the module was built as a dynamic module, you will need to add at the top of
44 your nginx configuration file the following line :
45
46 ```nginx
47 load_module "/path/to/ngx_http_powshield_module.so";
48 ```
49