Skip to content

Commit 03257e5

Browse files
committed
More info in the readme
More info in the readme
1 parent f560e1e commit 03257e5

File tree

1 file changed

+103
-1
lines changed

1 file changed

+103
-1
lines changed

README.md

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,106 @@ To compile nginx with this module, use an `--add-module` option to `configure`
2121

2222
```
2323
./configure --add-module=path/to/this/module/directory
24-
```
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/simpl/ngx_devel_kit/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+
```-std=gnu99```
59+
60+
```
61+
vi CMakeLists.txt
62+
cmake .
63+
make jwt_static
64+
65+
cd ~/dl
66+
git clone https://github.com/TeslaGov/ngx-http-auth-jwt-module
67+
68+
cd ~/dl
69+
wget http://nginx.org/download/nginx-1.10.1.tar.gz
70+
tar -xzf nginx-1.10.1.tar.gz
71+
ln -sf nginx-1.10.1 nginx
72+
cd nginx
73+
```
74+
75+
You may need to change this configure line to support your needs
76+
77+
```
78+
./configure
79+
--user=nginx \
80+
--group=nginx \
81+
--prefix=/etc/nginx \
82+
--sbin-path=/usr/sbin/nginx \
83+
--conf-path=/etc/nginx/nginx.conf \
84+
--pid-path=/var/run/nginx.pid \
85+
--lock-path=/var/run/nginx.lock \
86+
--error-log-path=/var/log/nginx/error.log \
87+
--http-log-path=/var/log/nginx/access.log \
88+
--with-http_gzip_static_module \
89+
--with-http_stub_status_module \
90+
--with-http_ssl_module \
91+
--with-pcre \
92+
--add-module=/root/dl/ngx-http-auth-jwt-module/src
93+
```
94+
95+
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.
96+
97+
I appended this to my CLFAGS line:
98+
99+
```
100+
-I /root/dl/libjwt/include -I /root/dl/jansson/src -std=gnu99
101+
```
102+
103+
I added these lines to to objs/nginx list:
104+
105+
```
106+
objs/addon/ngx_http_auth_jwt_module/ngx_http_auth_jwt_module.o \
107+
/root/dl/libjwt/lib/libjwt.a \
108+
/usr/local/lib/libjansson.a
109+
```
110+
111+
I added these lines to the xxx list:
112+
113+
```
114+
objs/addon/ngx_http_auth_jwt_module/ngx_http_auth_jwt_module.o \
115+
-L /root/dl/libjwt/lib \
116+
-L /usr/local/lib \
117+
-ldl -lpthread -lcrypt -lpcre -lssl -lcrypto -ldl -lz -ljwt -ljansson \
118+
-Wl,-E
119+
```
120+
121+
```
122+
vi Makefile
123+
make
124+
make install
125+
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
126+
```

0 commit comments

Comments
 (0)