下载并筹备nginx源码

从官网下载即可:http://nginx.org/en/download.html
之后应用tar zxvf解压。

下载安装pcre插件

可参考:https://blog.csdn.net/hjxloveqsx/article/details/121224144
办法是下载源码包后解压,进入执行./configure、make、make install。

下载安装openssl

可参考:https://cloud.tencent.com/developer/article/2292103?from=1542...
其中在编译时可能会报出Can't locate IPC/Cmd.pm in @INC,此时须要装置perl-CPAN,可参考:https://blog.csdn.net/sd4493091/article/details/122220902、ht...。我参考的是第一个链接,配置cpan的shell时全副应用默认配置。尔后openssl的装置步骤与后面雷同,即make、make install。

下载安装zlib

返回http://www.zlib.net/fossils/下载解压,之后执行./configure、make、make install。

装置nginx

进入nginx解压后的目录,执行./configure --prefix=/app/nginx/nginx --with-openssl=/app/nginx/openssl-3.1.0 --with-http_ssl_module --with-stream,其中prefix为指定装置目录,--with-openssl=/app/nginx/openssl-3.1.0为指定openssl源码门路(解压后的openssl门路,非装置后的,如果装置openssl后执行./configure仍然报找不到openssl则须要手动指定),--with-http_ssl_module和--with-stream为装置反对https和stream配置的插件,最初make、make install。
全副过程可参考:https://blog.csdn.net/m0_37959155/article/details/108913157