Access nginx.org to download latest stable version of nginx.
1
2
wget https://nginx.org/download/nginx-1.16.0.tar.gz
tar -zxvf nginx-1.16.0.tar.gz
Compile source code
1
2
3
4
5
cd nginx-1.16.0
apt update && apt install -y gcc build-essential
./configure --prefix=/home/echowings/nginx
make
make install
Trouble shooting
PCRE missing error.
1
2
3
4
5
6
7
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using —without–http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using —with–pcre=<path> option.
We need to install pcre library to support it.
1
2
3
4
5
# Install pcre for rhel or centosyum install pcre-devel
# Install pcre for debian or ubuntuapt install -y libpcre3 libpcre3-dev
gzip error.
1
2
3
4
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
We need to install gzip library.
1
2
3
4
5
# For rhel or centosyum install zlib-devel
# For debian or ubuntuapt install zlib1g zlib1g-dev