wget https://nginx.org/download/nginx-1.24.0.tar.gz
apt-get install -y gcc
apt-get install -y libpcre3 libpcre3-dev
apt-get install -y zlib1g zlib1g-dev
apt-get install -y openssl?
apt-get install -y libssl-dev
由于nginx安装ssl模块需要OpenSSL源码,故需要下载解压,
并通过--with-openssl指定
wget https://www.openssl.org/source/openssl-3.2.0.tar.gz --no-check-certificate
./configure \
--prefix=/root/app/nginx \
--conf-path=/root/app/nginx/nginx.conf \
--pid-path=/root/app/nginx/nginx.pid \
--sbin-path=/root/app/nginx/nginx \
--with-openssl=/root/app/openssl-3.2.0 \
--user=$USER \
--with-http_ssl_module \
--with-poll_module \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module
make && make install
cd /root/app/nginx
./nginx -t
./nginx
./nginx -s reload
./nginx -s stop
附: