nginx-1.21.0 source code compilation and installation

 1 minute to read

First download the nginx source code on the nginx official website, download address: http://nginx.org/en/download.html

New folder mkdir source

cd source

Download the source code wget http://nginx.org/download/nginx-1.21.0.tar.gz

Unzip the source file tar -xzvf nginx-1.21.0.tar.gz

cd nginx-1.21.0

Under the debian10 system, the dependencies needed to compile nginx must be installed

apt install gcc make

[Regular Expression Library] Official website http://www.pcre.org/

apt install libpcre3 libpcre3-dev

[openssl library] official website https://www.openssl.org/

apt install openssl libssl-dev

apt install zlib1g-dev

The nginx compilation parameters are as follows: ./configure --prefix=/home/john/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run /nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-select_module --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-mail --with-mail_ssl_module --with-cc -opt=-O2

make

sudo make install

sudo useradd -s /sbin/nologin -M nginx

sudo certbot --nginx -d yingzhou.online -d www.yingzhou.online