编译openssl
从github下载指定版本的源码 https://github.com/openssl/openssl/releases
-
下载后解压
tar -zcvf openssl-3.1.1.tar.gz
-
进入文件夹后配置
cd openssl-3.1.1 && ./Configure --prefix=/data/projects/build/openssl-3.1.1
--prefix参数指定路径
-
执行编译
make -j8
-
不需要安装到系统,此时当前目录下面会有
libssl.so和libcrypto.so
编译nginx
从github下载指定版本的源码 https://github.com/nginx/nginx/tags
- 下载后解压
tar -zcvf nginx-release-1.25.0.tar.gz
- 进入文件夹后配置
cd nginx-release-1.25.0
- 执行配置
./auto/configure --prefix=/data/projects/nginx --with-http_v2_module \
--with-http_ssl_module \
--with-openssl=/data/projects/build/openssl-3.1.1
-
执行编译
make -j8
-
最后在当前目录的objs下面会生成nginx可执行文件
objs/nginx
启动nginx
nginx -c /xxx/nginx.conf