Install NGINX from source

Adler @ 2018-07-08


The benefit of installing nginx from source is that you can select to install either 3rd party modules or built-in modules.

# build-essential & PCRE for compiling C program
# zlib for gzipping
# ssl for https support 
sudo apt-get install -y build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev

wget https://nginx.org/download/nginx-1.14.0.tar.gz
tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

./configure \
  --sbin-path=/usr/bin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --with-pcre \
  --pid-path=/var/run/nginx.pid
make
make install
nginx -V # make sure it works!
nginx # to start, it should start listening to port 80