Skip to content

Commit da89753

Browse files
authored
Update README.md
1 parent 22905b9 commit da89753

File tree

1 file changed

+2
-111
lines changed

1 file changed

+2
-111
lines changed

README.md

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -17,115 +17,6 @@ auth_jwt_enabled on;
1717

1818
So, a typical use would be to specify the key and loginurl on the main level and then only turn on the locations that you want to secure (not the login page).
1919

20-
To compile nginx with this module, use an `--add-module` option to `configure`
20+
The Dockerfile builds all of the dependencies as well as the module, downloads a binary version of nginx, and runs the module as a dynamic module.
2121

22-
```
23-
./configure --add-module=path/to/this/module/directory
24-
```
25-
26-
# All commands
27-
Here's a list of all of the commands I used on a fresh CentOS VM to get this up and running
28-
29-
```
30-
yum update
31-
yum -y groupinstall 'Development Tools'
32-
yum -y install unzip zip gunzip wget httpd-devel pcre perl pcre-devel zlib zlib-devel GeoIP GeoIP-devel openssl openssl-devel cmake git
33-
cd
34-
mkdir dl
35-
cd dl
36-
wget https://github.com/akheron/jansson/archive/2.8.zip
37-
unzip 2.8.zip
38-
ln -sf jansson-2.8 jansson
39-
cd jansson
40-
cmake .
41-
make
42-
make install
43-
cd ~/dl
44-
wget https://github.com/benmcollins/libjwt/archive/master.zip
45-
unzip master.zip
46-
ln -sf libjwt-master libjwt
47-
cd libjwt
48-
```
49-
50-
To compile libjwt on my mac I had to edit the `CMakeLists.txt` file and add this line at the top:
51-
52-
```
53-
include_directories(/usr/local/Cellar/openssl/1.0.2h_1/include/)
54-
```
55-
56-
To compile libjwt on my CentOS VM I had to edit the `CMakeLists.txt` file and add this flag to the list of `CMAKE_C_FLAGS`:
57-
58-
```
59-
-std=gnu99
60-
```
61-
more commands...
62-
63-
```
64-
vi include/jwt.h
65-
vi libjwt/jwt.c
66-
vi CMakeLists.txt
67-
cmake .
68-
make jwt_static
69-
70-
cd ~/dl
71-
git clone https://github.com/TeslaGov/ngx-http-auth-jwt-module
72-
73-
cd ~/dl
74-
wget http://nginx.org/download/nginx-1.10.1.tar.gz
75-
tar -xzf nginx-1.10.1.tar.gz
76-
ln -sf nginx-1.10.1 nginx
77-
cd nginx
78-
```
79-
80-
You may need to change this configure line to support your needs
81-
82-
```
83-
./configure
84-
--user=nginx \
85-
--group=nginx \
86-
--prefix=/etc/nginx \
87-
--sbin-path=/usr/sbin/nginx \
88-
--conf-path=/etc/nginx/nginx.conf \
89-
--pid-path=/var/run/nginx.pid \
90-
--lock-path=/var/run/nginx.lock \
91-
--error-log-path=/var/log/nginx/error.log \
92-
--http-log-path=/var/log/nginx/access.log \
93-
--with-http_gzip_static_module \
94-
--with-http_stub_status_module \
95-
--with-http_ssl_module \
96-
--with-pcre \
97-
--add-module=/root/dl/ngx-http-auth-jwt-module/src
98-
```
99-
100-
At this point I needed to edit the Makefile. I couldn't figure out how to link in the dependent libraries via the configure command so I added them in by hand.
101-
102-
I appended this to my CLFAGS line:
103-
104-
```
105-
-I /root/dl/libjwt/include -I /root/dl/jansson/src -std=gnu99
106-
```
107-
108-
I added these lines to objs/nginx list:
109-
110-
```
111-
objs/addon/ngx_http_auth_jwt_module/ngx_http_auth_jwt_module.o \
112-
/root/dl/libjwt/lib/libjwt.a \
113-
/usr/local/lib/libjansson.a
114-
```
115-
116-
I added these lines to the link command:
117-
118-
```
119-
objs/addon/ngx_http_auth_jwt_module/ngx_http_auth_jwt_module.o \
120-
-L /root/dl/libjwt/lib \
121-
-L /usr/local/lib \
122-
-ldl -lpthread -lcrypt -lpcre -lssl -lcrypto -ldl -lz -ljwt -ljansson \
123-
-Wl,-E
124-
```
125-
126-
```
127-
vi Makefile
128-
make
129-
make install
130-
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
131-
```
22+
Have a look at build.sh, which creates the docker image and container and executes some test requests to illustrate that some pages are secured by the module and requre a valid JWT.

0 commit comments

Comments
 (0)