编译 nginx + http-flv 模块
一、源码准备
注意:Windows下下载.zip文件,Linux下下载.tar.gz文件,之前出现过.zip解压后pcre编译不过的情况
1、下载nginx 官网 github
2、下载PCRE 官网 github
3、下载zlib 官网 github
4、下载OpenSSL 官网 github
5、下载nginx-http-flv-module github
二、Windows 编译环境准备
1、下载安装MSYS2 官网
2、下载安装Strawberry Perl 官网
三、开始编译
1、将第一步下载的源代码解压,目录结构为
xxx代表是版本号
nginx-xxx
nginx-http-flv-module-xxx
openssl-xxx
pcre-xxx
zlib-xxx
Linux下编译
1、cd到nginx目录,执行
auto/configure \
--with-cc=gcc \
--with-debug \
--with-stream \
--with-http_ssl_module \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-zlib=../zlib-1.2.13 \
--with-pcre=../pcre2-10.40 \
--with-openssl=../openssl-openssl-3.0.6 \
--with-openssl-opt=no-asm \
--prefix=../nginx \
--sbin-path=nginx \
--conf-path=conf/nginx.conf \
--pid-path=logs/nginx.pid \
--http-log-path=logs/access.log \
--error-log-path=logs/error.log \
--http-client-body-temp-path=temp/client_body_temp \
--http-proxy-temp-path=temp/proxy_temp \
--http-fastcgi-temp-path=temp/fastcgi_temp \
--http-scgi-temp-path=temp/scgi_temp \
--http-uwsgi-temp-path=temp/uwsgi_temp \
--add-module=../nginx-http-flv-module-1.2.10
2、再执行
make install
Windows 下编译
1、打开MSYS2 MSYS
2、cd到nginx目录
3、执行configure进行配置,注意目录是否正确
auto/configure \
--with-cc=cl \
--with-debug \
--with-stream \
--with-http_ssl_module \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=../pcre2-10.40 \
--with-zlib=../zlib-1.2.13 \
--with-openssl=../openssl-openssl-3.0.6 \
--with-openssl-opt=no-asm \
--prefix=E:/nginx \
--sbin-path=nginx.exe \
--conf-path=conf/nginx.conf \
--pid-path=logs/nginx.pid \
--http-log-path=logs/access.log \
--error-log-path=logs/error.log \
--http-client-body-temp-path=temp/client_body_temp \
--http-proxy-temp-path=temp/proxy_temp \
--http-fastcgi-temp-path=temp/fastcgi_temp \
--http-scgi-temp-path=temp/scgi_temp \
--http-uwsgi-temp-path=temp/uwsgi_temp \
--add-module=../nginx-http-flv-module-1.2.10
4、打开"x86 Native Tools Command Prompt for VS 2017"
中文翻译应该是"适用于 VS 2017 的 x86 本机工具命令提示"
5、cd到nginx目录
6、执行nmake
编译出来的nginx.exe在\nginx-release-1.21.1\objs目录下。