编译环境准备
- 下载nginx安装包
官网:https://nginx.org/en/
下载安装包:
wget https://nginx.org/download/nginx-1.20.1.tar.gz
- 下载ssl源码
官网:https://github.com/openssl/openssl/releases
下载安装包:
wget https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1k.tar.gz
- 下载pcre源码
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz
- 下载zlib库源码
wget http://zlib.net/zlib-1.2.11.tar.gz
编译
1. 环境配置
执行configure脚本,配置编译的环境
启用http2 --with-http_v2_module
./configure \
--user=www-data \
--group=www-data \
--with-http_v2_module \
--with-http_ssl_module \
--with-stream \
--with-openssl=../openssl-OpenSSL_1_1_1k \
--with-pcre=../pcre-8.40 \
--with-pcre-jit \
--with-zlib=../zlib-1.2.11
启用geoip --with-http_geoip_module
启用geoip需要先安装libgeoip-dev库
apt-get install libgeoip-dev
2. 编译安装
make && make install