blob: 0e02f57079fb65afccad91e81993e99db36d6640 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
NGX_PAGESPEED_VERSION=1.9.32.10
NGX_VERSION=1.8.0
BUILD_DIR=nginx-$(NGX_VERSION)
all: fetch build
fetch: fetch_core fetch_dep pagespeed
fetch_core:
# Downloading source
test -f nginx-$(NGX_VERSION).tar.gz || wget http://nginx.org/download/nginx-$(NGX_VERSION).tar.gz
# Downloading signature
test -f nginx-$(NGX_VERSION).tar.gz.asc || wget http://nginx.org/download/nginx-$(NGX_VERSION).tar.gz.asc
# Getting public key
gpg --keyserver keyserver.ubuntu.com --recv-keys A1C052F8
# Verifying archiv
gpg --verify nginx-$(NGX_VERSION).tar.gz.asc nginx-$(NGX_VERSION).tar.gz
mkdir -p $(BUILD_DIR)
tar xzf nginx-$(NGX_VERSION).tar.gz
fetch_dep:
cd $(BUILD_DIR) && git clone https://github.com/agentzh/headers-more-nginx-module.git
cd $(BUILD_DIR) && git clone https://github.com/nbs-system/naxsi.git
cd $(BUILD_DIR) && git clone https://github.com/FRiCKLE/ngx_cache_purge.git
cd $(BUILD_DIR) && git clone https://github.com/simpl/ngx_devel_kit.git
cd $(BUILD_DIR) && git clone https://github.com/agentzh/echo-nginx-module.git
cd $(BUILD_DIR) && git clone https://github.com/chaoslawful/lua-nginx-module.git
cd $(BUILD_DIR) && git clone https://github.com/wandenberg/nginx-push-stream-module.git
cd $(BUILD_DIR) && git clone https://github.com/arut/nginx-rtmp-module.git
cd $(BUILD_DIR) && git clone https://github.com/masterzen/nginx-upload-progress-module.git
cd $(BUILD_DIR) && git clone https://github.com/gnosek/nginx-upstream-fair.git
cd $(BUILD_DIR) && git clone https://github.com/aperezdc/ngx-fancyindex.git
cd $(BUILD_DIR) && git clone https://github.com/tony2001/ngx_http_pinba_module.git
cd $(BUILD_DIR) && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
cd $(BUILD_DIR) && git clone https://github.com/pagespeed/ngx_pagespeed.git
cd $(BUILD_DIR) && git clone https://github.com/alibaba/nginx-http-concat/
cd $(BUILD_DIR) && git clone https://github.com/zebrafishlabs/nginx-statsd
cd $(BUILD_DIR) && git clone https://github.com/newobj/nginx-x-rid-header
cd $(BUILD_DIR) && git clone https://github.com/openresty/set-misc-nginx-module
cd $(BUILD_DIR) && git clone https://github.com/openresty/redis2-nginx-module
mkdir $(BUILD_DIR)/nginx-syslog && wget -O $(BUILD_DIR)/nginx-syslog/config https://raw.githubusercontent.com/gplessis/dotdeb-nginx/wheezy/debian/modules/nginx-syslog/config
build:
cd $(BUILD_DIR) && ./configure \
--with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' \
--lock-path=/var/lock/nginx.lock \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--user=www-data \
--group=www-data \
--with-ipv6 \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_flv_module \
--with-http_secure_link_module \
--with-http_spdy_module \
--with-http_sub_module \
--with-http_addition_module \
--with-google_perftools_module \
--with-http_gunzip_module \
--with-http_random_index_module \
--with-http_geoip_module \
--add-module=headers-more-nginx-module \
--add-module=naxsi/naxsi_src \
--add-module=ngx_cache_purge \
--add-module=ngx_devel_kit \
--add-module=echo-nginx-module \
--add-module=lua-nginx-module \
--add-module=nginx-push-stream-module \
--add-module=nginx-rtmp-module \
--add-module=nginx-syslog \
--add-module=nginx-upload-progress-module \
--add-module=nginx-upstream-fair \
--add-module=ngx-fancyindex \
--add-module=ngx_http_pinba_module \
--add-module=ngx_http_substitutions_filter_module \
--add-module=./ngx_pagespeed \
--add-module=./nginx-http-concat \
--with-cc-opt=-I/usr/include/ossp \
--with-ld-opt=-lossp-uuid \
--add-module=./nginx-x-rid-header \
--add-module=./set-misc-nginx-module \
--add-module=./redis2-nginx-module \
--add-module=./nginx-statsd $(NGX_CONFIGURE)
cd $(BUILD_DIR)/ && \
bash -c "make -j $$(grep -c processor /proc/cpuinfo)"
install:
cd $(BUILD_DIR)/ && make install
clean:
rm nginx-$(NGX_VERSION).tar.gz
rm nginx-$(NGX_VERSION).tar.gz.asc
prepare:
@(lsb_release -a | grep Debian || ! test -z $(DEBIAN)) || (echo "You don't run Debian, do you? This section is optimized for the Debian GNU/Linux distro.\nOverwrite it with 'DEBIAN=1 make prepare'.\n" && exit 1)
dpkg -l | grep build-essential || apt-get install -y build-essential
dpkg -l | grep zlib1g-dev || apt-get install -y zlib1g-dev
dpkg -l | grep -E '^libpcre3$$' || apt-get install -y libpcre3
dpkg -l | grep -E '^libpcre3-dev$$' || apt-get install -y libpcre3-dev
dpkg -l | grep liblua5.1-0-dev || apt-get install -y liblua5.1-0-dev
dpkg -l | grep libossp-uuid-dev || apt-get install -y libossp-uuid-dev
dpkg -l | grep uuid-dev || apt-get install -y uuid-dev
dpkg -l | grep libgoogle-perftools-dev || apt-get install -y libgoogle-perftools-dev
dpkg -l | grep libssl-dev || apt-get install -y libssl-dev
dpkg -l | grep libgeoip-dev || apt-get install -y libgeoip-dev
pagespeed:
@(test -d $(BUILD_DIR)/ngx_pagespeed && cd $(BUILD_DIR)/ngx_pagespeed && \
echo "Downloading pagespeed library." && \
# Documentation recommends now to download from Github:
# https://github.com/pagespeed/ngx_pagespeed/archive/release-${NGX_PAGESPEED_VERSION}-beta.zip
wget https://dl.google.com/dl/page-speed/psol/$(NGX_PAGESPEED_VERSION).tar.gz && \
tar -xzvf $(NGX_PAGESPEED_VERSION).tar.gz) || \
echo "You need to run 'make fetch_dep' first to download ngx_pagespeed."
help:
@echo "This is a Makefile to automatize compiling nginx from source.\n"
@echo "Run 'make fetch' to fetch the core and addons."
@echo "Run 'make build' to configure and compile nginx. If you want to pass options to ./configure you can do this with 'NGX_CONFIGURE=options... make build' on the commmand line."
@echo "'make install' will install it system wide (needs root privileges)."
@echo "If you are on GNU/Debian, you can run 'make prepare' to install some needed libraries."
|