nginx+rtmp+ffmpeg,windows下编译

nginx:1.15.7(http://nginx.org/en/download.html)

note:单独下载的源码包里包含makefile,但是还需要下载最新的源码,因为官方download给的链接下载的文件里面会缺少很多源码。vs编译的时候会提示无法生成相应.o文件。所以要下载最新源码覆盖进去。

nginx-rtmp-moudle:1.1.4(https://github.com/arut/nginx-rtmp-module)

pcre:pcre-8.42(http://www.pcre.org/)

zlib:zlib-1.2.11(http://www.zlib.net/)

openssl:openssl-1.0.2p(http://www.openssl.org/)

步骤:

  1. 在nginx文件目录中新建objs,然后在其内再新建lib文件夹,把上面4个源码包放进去。
  2. 然后用mingw32,或msys2的mingw32,cd到nginx目录进行配置生成文件会放置到objs目录下。

./configure \
--with-cc=cl \
--with-debug \
--prefix= \
--conf-path=conf/nginx.conf \
--pid-path=logs/nginx.pid \
--http-log-path=logs/access.log \
--error-log-path=logs/error.log \
--sbin-path=nginx.exe \
--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 \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=objs/lib/pcre-8.42 \
--with-zlib=objs/lib/zlib-1.2.11 \
--with-openssl=objs/lib/openssl-1.0.2p \
--with-openssl-opt=no-asm \
--with-select_module \
--with-http_ssl_module \
--add-module=objs/lib/nginx-rtmp-module
 

  1. 打开vs2015的命令行窗口,用x64和x86兼容的,开始编译

nmake -f objs/Makefile

  1. 编译后在objs下生成的exe目录下增加tmp,temp,conf,logs,html文件夹,并把nginx下的conf中的配置文件拷到objs下的conf中,配置好后就可以启动nginx.exe了。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章