NGINX from scratch


on debian/ubuntu, make sure you got the build essential packages, PCRE, zlib and openssl libs,

apt install build-essential libpcre3-dev zlib1g-dev libssl-dev
#apt install checkinstall

on slackware, for building the thing

slackpkg install pcre zlib

for ngx_http_xslt_module

#slackpkg install libxml2 libxslt

and for running the thing (optional, as it otherwise runs as nobody:nobody)

groupadd -g 65001 www
useradd -u 65001 -g 65001 --system -d /usr/local/nginx -s /sbin/nologin www


fetch latest NGINX source

gpg --verify nginx-1.19.0.tar.gz.asc
gpg --recv-key A1C052F8
gpg --verify nginx-1.19.0.tar.gz.asc

you should get good signature with fingerprint

Primary key fingerprint: B0F4 2533 73F8 F6F5 10D4  2178 520A 9993 A1C0 52F8

extract and build

git clone

tar xzf nginx-1.19.0.tar.gz
cd nginx-1.19.0/

we want NGINX to be available in our known PATH and MANPATH. we absolutely need that /etc/nginx/ folder as many files get deployed within

./configure --help | less

make clean #strange one that erases Makefile
bind 'set disable-completion on'
./configure --prefix=/usr/local \
    --modules-path=/etc/nginx/modules \
    --conf-path=/etc/nginx/nginx.conf \
    --pid-path=/var/run/ --lock-path=/var/lock/nginx.lock \
    --user=www --group=www \
    --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log \
    --with-http_ssl_module --with-http_v2_module \
    --with-http_addition_module --with-http_sub_module \
    --with-http_stub_status_module --with-http_gzip_static_module
    #--with-http_addition_module --add-module=../ngx-fancyindex \
    #--with-http_xslt_module \
    #--with-mail --with-mail_ssl_module --with-mail_smtp_module --with-mail_imap_module
bind 'set disable-completion off'

time nice make -j2 > ../nginx.log && echo BUILT
#1m49.628s on two weak cores

make install
ls -alhF /var/log/nginx/
mkdir /var/www/
mv /usr/local/html/ /var/www/
which nginx
nginx -V
ls -lhF /etc/nginx/


this would have been for defining a static module (main context), but there is no need

#ls -lF /usr/local/nginx/modules/
#vi /usr/local/nginx/nginx.conf
#load_module modules/;


HOWTO build nginx with HTTP 2 support

The HTTP/2 Module in NGINX

Fancy Index

Module ngx_http_addition_module

Compiling Third-Party Dynamic Modules for NGINX and NGINX Plus

Converting Static Modules to Dynamic Modules