step 1. 更新系统
sudo apt update
sudo apt upgrade -y
step 2. 下载nginx并解压
wget http://nginx.org/download/nginx-1.19.10.tar.gz
tar -zxvf nginx-1.19.10.tar.gz
step 3. 安装必要包
sudo apt install make libpcre3 libpcre3-dev libssl-dev zlib1g zlib1g-dev libxslt1.1 libxslt1-dev libgd3 libgd-dev
step 4. 创建nginx用户及分组
sudo groupadd -r nginx
sudo useradd -r -g nginx -s /bin/false -d /usr/local/nginx -M nginx
step 5. 生成make配置
./configure --prefix=/opt/nginx \
--user=nginx --group=ngix \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log