Nginx

How to install and configure Nginx

Install Nginx on Ubuntu

echo -e \
"deb [arch=amd64] http://nginx.org/packages/ubuntu/ $(lsb_release -cs) nginx\n\
#deb-src [arch=amd64] http://nginx.org/packages/ubuntu/ $(lsb_release -cs) nginx" | \
sudo tee /etc/apt/sources.list.d/nginx.list
wget -q "http://nginx.org/packages/keys/nginx_signing.key" -O-| sudo apt-key add -
sudo apt update && sudo apt install nginx -y

Compile External Module

Check Nginx version

nginx -v
sudo apt update && sudo apt install libpcre3 libpcre3-dev git gcc
wget http://nginx.org/download/nginx-1.18.0.tar.gz
tar xf nginx-1.18.0.tar.gz
git clone https://github.com/google/ngx_brotli
cd ngx_brotli
git submodule update --init
cd ../nginx-1.18.0
./configure  --add-dynamic-module=../ngx_brotli $(nginx -V) --with-compat
make

Security Header

Add on /etc/nginx/nginx.conf

References

Last updated