compile/nginxFromSource
About
Prepare
Clone the source
Possible dependencies
--with-http_xslt_module=dynamic
libxml2: http://xmlsoft.org/
libxslt: http://xmlsoft.org/XSLT/
apt install libxml2-dev libxslt-dev
--with-pcre
libpcre2:
- New Perl Compatible Regular Expression Library
apt install libpcre2-dev
--with-zlib
zlib1g:
apt install zlib1g-dev
--with-libatomic
libatomic_ops: https://github.com/ivmai/libatomic_ops
apt install libatomic-ops-dev
--with-openssl
libssl:
apt install libssl-dev
--with-http_image_filter_module=dynamic
--with-http_image_filter_module=dynamic
--with-http_geoip_module=dynamic or --with-stream_geoip_module=dynamic
libGeoIP:
Configure
Look for errors in
build/autoconf.err
Show and extract sorted list of compile time options to be enabled
1 auto/configure --help | less
2 auto/configure --help \
3 | cut -d\ -f 3 \
4 | grep -e '--with-' -e '--build' -e '--prefix' \
5 | grep -v -e '--with-select_module' -e '--with-poll_module' \
6 | sed -r 's/^\s*/\t/;s/$/ \\/' \
7 | sort
8
9 --builddir=DIR \
10 --build=NAME \
11 --prefix=PATH \
12 --with-cc-opt=OPTIONS \
13 --with-cc=PATH \
14 --with-compat \
15 --with-cpp=PATH \
16 --with-cpp_test_module \
17 --with-cpu-opt=CPU \
18 --with-debug \
19 --with-file-aio \
20 --with-google_perftools_module \
21 --with-http_addition_module \
22 --with-http_auth_request_module \
23 --with-http_dav_module \
24 --with-http_degradation_module \
25 --with-http_flv_module \
26 --with-http_geoip_module \
27 --with-http_geoip_module=dynamic \
28 --with-http_gunzip_module \
29 --with-http_gzip_static_module \
30 --with-http_image_filter_module \
31 --with-http_image_filter_module=dynamic \
32 --with-http_mp4_module \
33 --with-http_perl_module \
34 --with-http_perl_module=dynamic \
35 --with-http_random_index_module \
36 --with-http_realip_module \
37 --with-http_secure_link_module \
38 --with-http_slice_module \
39 --with-http_ssl_module \
40 --with-http_stub_status_module \
41 --with-http_sub_module \
42 --with-http_v2_module \
43 --with-http_v3_module \
44 --with-http_xslt_module \
45 --with-http_xslt_module=dynamic \
46 --with-ld-opt=OPTIONS \
47 --with-libatomic \
48 --with-libatomic=DIR \
49 --with-mail \
50 --with-mail=dynamic \
51 --with-mail_ssl_module \
52 --with-openssl=DIR \
53 --with-openssl-opt=OPTIONS \
54 --with-pcre \
55 --with-pcre=DIR \
56 --with-pcre-jit \
57 --with-pcre-opt=OPTIONS \
58 --with-perl_modules_path=PATH \
59 --with-perl=PATH \
60 --with-stream \
61 --with-stream=dynamic \
62 --with-stream_geoip_module \
63 --with-stream_geoip_module=dynamic \
64 --with-stream_realip_module \
65 --with-stream_ssl_module \
66 --with-stream_ssl_preread_module \
67 --with-threads \
68 --with-zlib-asm=CPU \
69 --with-zlib=DIR \
70 --with-zlib-opt=OPTIONS \
71
List of compile time options - Debian 12 (Bookworm)
1 ### DEBIAN COMPILE TIME OPTIONS
2 % nginx -V
3 nginx version: nginx/1.22.1
4 built with OpenSSL 3.0.8 7 Feb 2023 (running with OpenSSL 3.0.15 3 Sep 2024)
5 TLS SNI support enabled
6 configure arguments: --with-cc-opt='-g -O2 -ffile-prefix-map=/build/nginx-AoTv4W/nginx-1.22.1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=stderr --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --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 --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-mail_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_realip_module --with-http_geoip_module=dynamic --with-http_image_filter_module=dynamic --with-http_perl_module=dynamic --with-http_xslt_module=dynamic --with-mail=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic
7
8 ### SORTED TO BE DIFFABLE
9 % nginx -V 2>&1 | sed 's/ --/\n\t--/g'
10 % nginx -V 2>&1 \
11 | grep 'configure arguments:' \
12 | sed 's/ --/\n\t--/g' \
13 | grep -v 'configure arguments:' \
14 |sort
15
16 --with-cc-opt='-g -O2 -ffile-prefix-map=/build/nginx-AoTv4W/nginx-1.22.1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2'
17 --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC'
18 --prefix=/usr/share/nginx
19 --conf-path=/etc/nginx/nginx.conf
20 --http-log-path=/var/log/nginx/access.log
21 --error-log-path=stderr
22 --lock-path=/var/lock/nginx.lock
23 --pid-path=/run/nginx.pid
24 --modules-path=/usr/lib/nginx/modules
25 --http-client-body-temp-path=/var/lib/nginx/body
26 --http-fastcgi-temp-path=/var/lib/nginx/fastcgi
27 --http-proxy-temp-path=/var/lib/nginx/proxy
28 --http-scgi-temp-path=/var/lib/nginx/scgi
29 --http-uwsgi-temp-path=/var/lib/nginx/uwsgi
30 --with-compat
31 --with-debug
32 --with-pcre-jit
33 --with-http_ssl_module
34 --with-http_stub_status_module
35 --with-http_realip_module
36 --with-http_auth_request_module
37 --with-http_v2_module
38 --with-http_dav_module
39 --with-http_slice_module
40 --with-threads
41 --with-http_addition_module
42 --with-http_flv_module
43 --with-http_gunzip_module
44 --with-http_gzip_static_module
45 --with-http_mp4_module
46 --with-http_random_index_module
47 --with-http_secure_link_module
48 --with-http_sub_module
49 --with-mail_ssl_module
50 --with-stream_ssl_module
51 --with-stream_ssl_preread_module
52 --with-stream_realip_module
53 --with-http_geoip_module=dynamic
54 --with-http_image_filter_module=dynamic
55 --with-http_perl_module=dynamic
56 --with-http_xslt_module=dynamic
57 --with-mail=dynamic
58 --with-stream=dynamic
59 --with-stream_geoip_module=dynamic
In this special case a full-fledged nginx with support for PCRE and OpenSSL is necessary to be built to be run from a user home directory. configure_options.txt
1 ### SELECTED COMPILE TIME OPTIONS
2 --builddir="build" \
3 --build="rsit_$(date +%F_%H%M)" \
4 --prefix="$HOME/local" \
5 --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' \
6 #--with-cc=PATH \
7 --with-compat \
8 #--with-cpp=PATH \
9 #--with-cpp_test_module \
10 #--with-cpu-opt=CPU \
11 --with-debug \
12 --with-file-aio \
13 #--with-google_perftools_module \
14 --with-http_addition_module \
15 --with-http_auth_request_module \
16 --with-http_dav_module \
17 --with-http_degradation_module \
18 --with-http_flv_module \
19 #--with-http_geoip_module \
20 --with-http_geoip_module=dynamic \
21 --with-http_gunzip_module \
22 --with-http_gzip_static_module \
23 #--with-http_image_filter_module \
24 --with-http_image_filter_module=dynamic \
25 --with-http_mp4_module \
26 #--with-http_perl_module \
27 --with-http_perl_module=dynamic \
28 --with-http_random_index_module \
29 --with-http_realip_module \
30 --with-http_secure_link_module \
31 --with-http_slice_module \
32 --with-http_ssl_module \
33 --with-http_stub_status_module \
34 --with-http_sub_module \
35 --with-http_v2_module \
36 --with-http_v3_module \
37 #--with-http_xslt_module \
38 --with-http_xslt_module=dynamic \
39 --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' \
40 --with-libatomic \
41 --with-libatomic=DIR \
42 #--with-mail \
43 --with-mail=dynamic \
44 --with-mail_ssl_module \
45 --with-openssl=DIR \
46 --with-openssl-opt=OPTIONS \
47 --with-pcre \
48 --with-pcre=DIR \
49 --with-pcre-jit \
50 --with-pcre-opt=OPTIONS \
51 --with-perl_modules_path=PATH \
52 --with-perl=PATH \
53 #--with-stream \
54 --with-stream=dynamic \
55 #--with-stream_geoip_module \
56 --with-stream_geoip_module=dynamic \
57 --with-stream_realip_module \
58 --with-stream_ssl_module \
59 --with-stream_ssl_preread_module \
60 --with-threads \
61 #--with-zlib-asm=CPU \
62 --with-zlib=DIR \
63 --with-zlib-opt=OPTIONS \
64
Show compile time options
Make
1 make -j $(nproc)
Make install