Skip to content

Commit aefebd0

Browse files
Shannon WynterShannon Wynter
authored andcommitted
Make it built
1 parent 95b2e1e commit aefebd0

File tree

2 files changed

+32
-91
lines changed

2 files changed

+32
-91
lines changed

README.md

Lines changed: 18 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -23,109 +23,36 @@ To compile nginx with this module, use an `--add-module` option to `configure`
2323
./configure --add-module=path/to/this/module/directory
2424
```
2525

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
26+
# Full ubuntu install example
2827

2928
```
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`:
29+
apt-get -y install curl wget git-core build-essential libjansson-dev libssl-dev libsslcommon2-dev libpcre3-dev software-properties-common openssl libjansson-dev autoconf libgeoip-dev
5730
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
31+
git clone https://github.com/benmcollins/libjwt
32+
cd libjwt
33+
autoreconf -i
34+
./configure --prefix=/usr --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info
35+
make all
36+
make install
8137
82-
```
83-
./configure
84-
--user=nginx \
85-
--group=nginx \
38+
curl -s http://nginx.org/download/nginx-1.11.10.tar.gz | tar -zxf -
39+
git clone https://github.com/freman/ngx-http-auth-jwt-module
40+
cd nginx-1.11.10
41+
./configure \
42+
--user=www-data \
43+
--group=www-data \
8644
--prefix=/etc/nginx \
8745
--sbin-path=/usr/sbin/nginx \
8846
--conf-path=/etc/nginx/nginx.conf \
8947
--pid-path=/var/run/nginx.pid \
9048
--lock-path=/var/run/nginx.lock \
9149
--error-log-path=/var/log/nginx/error.log \
9250
--http-log-path=/var/log/nginx/access.log \
51+
--with-http_addition_module \
52+
--with-http_geoip_module \
9353
--with-http_gzip_static_module \
9454
--with-http_stub_status_module \
9555
--with-http_ssl_module \
9656
--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-
```
57+
--add-module=../ngx-http-auth-jwt-module
58+
```

config

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ngx_addon_name=ngx_http_auth_jwt_module
2+
3+
if test -n "$ngx_module_link"; then
4+
ngx_module_type=HTTP
5+
ngx_module_name=ngx_http_auth_jwt_module
6+
ngx_module_srcs="$ngx_addon_dir/src/ngx_http_auth_jwt_module.c"
7+
ngx_module_libs="-ljwt -ljansson"
8+
9+
. auto/module
10+
else
11+
HTTP_MODULES="$HTTP_MODULES ngx_http_auth_jwt_module"
12+
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_auth_jwt_module.c"
13+
CORE_LIBS="$CORE_LIBS -ljwt -ljansson"
14+
fi

0 commit comments

Comments
 (0)