1 Download the necessary software
Download msys:http://xhmikosr.1f0.de/tools/msys/msys_mingw-w64_gcc_610_x86-x64_full.7z from http://xhmikosr.1f0.de/tools/msys/.
Extract the Msys from the msys_mingw-w64_gcc_610_x86-x64_full.7z compressed package to the C packing directory.
How to build nginx
Install Windwos version of Git. https://git-for-windows.github.io/
Https://github.com/git-for-windows/git/releases/download/v2.9.3.windows.1/Git-2.9.3-64-bit.exe
Vc2015:https://www.visualstudio.com/downloads/download-visual-studio-vs
Nginx build
Installing Perl
Http://www.activestate.com/activeperl/downloads
http://www.activestate.com/activeperl/downloads/thank-you?dl=http://downloads.activestate.com/ActivePerl/ Releases/5.24.0.2400/activeperl-5.24.0.2400-mswin32-x86-64int-300560.exe
Install HG Code management tool, download Nginx source. You need to set the environment variable path to join C:\Program files\mercurial.
Https://www.mercurial-scm.org/release/windows/Mercurial-3.9-x64.exe
2 Download the source code package to compile Nginx
Cmd.exe
D:
CD d:\git\
HG Clone Http://hg.nginx.org/nginx
CD Nginx
HG tags find the latest tag is release-1.11.3
Move out of the latest stable version code
HG Co release-1.11.3
# Modify the error level to 3 levels, D:\GIT\NGINX\AUTO\CC\MSVC 83 lines, change-W4 to-W3
# Otherwise, at compile time (nmake-f build/makefile), the following error will occur:
# build/lib/nginx-rtmp-module/ngx_rtmp_core_module.c (611): Error C2220: Warning is treated as error-no "object" file generated
# build/lib/nginx-rtmp-module/ngx_rtmp_core_module.c (611): Warning C4456: the declaration of "SA" hides the previous local declaration
# build/lib/nginx-rtmp-module/ngx_rtmp_core_module.c (611): NOTE: To simplify migration, consider temporarily using/wv:18 tags for compiler versions that are used to generate and do not raise warnings
# build/lib/nginx-rtmp-module/ngx_rtmp_core_module.c (506): note: see Declaration of "SA"
# nmake:fatal Error U1077: "" C:\Program Files (x86) \microsoft Visual Studio 14.0\vc\bin\cl. EXE "": Return Code "0x2"
# Stop.
D:\git\nginx\auto\cc\msvc
cflags= "$CFLAGS-w4" ==> cflags= "$CFLAGS-w3"
mkdir Build
mkdir Build\lib
# download Nginx-rtmp-module code, checkout stable version
git clone https://github.com/arut/nginx-rtmp-module.git
CD Nginx-rtmp-module
git tag
git checkout-b b1.1.9 v1.1.9
# Open the Msys environment and download the necessary source packages.
C:\msys\msys.bat
In the Msys window, enter:
CD d:/git/nginx/build/lib/
# download OPENSLL, Pcre, zlib to Lib directory, and unzip
wget ftp://ftp.openssl.org/source/old/1.0.1/openssl-1.0.1s.tar.gz
wget http://downloads.sourceforge.net/pcre/pcre-8.39.tar.bz2
wget http://zlib.net/zlib-1.2.8.tar.gz
Tar-xzf openssl-1.0.1s.tar.gz
TAR-JXVF pcre-8.39.tar.bz2
Tar-xzf zlib-1.2.8.tar.gz
3 compiling
CD D:/git/nginx
# in the/d/git/nginx directory of Msys, execute the auto/configure as follows:
Auto/configure--with-cc=cl--builddir=build--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 \
--with-cc-opt=-dfd_setsize=1024--with-pcre=build/lib/pcre-8.39 \
--with-zlib=build/lib/zlib-1.2.8--with-openssl=build/lib/openssl-1.0.1s \
--with-select_module--with-http_ssl_module--with-ipv6 \
--with-http_sub_module \
--add-module=build/lib/nginx-rtmp-module
Run in the cmd window:
D:
CD D:/git/nginx
"C:\Program Files (x86) \microsoft Visual Studio 14.0\vc\bin\vcvars32.bat"
Nmake-f Build/makefile
After the run is complete, the CMD command-line window displays:
Library Search Completed
Sed-e "s|%prefix%| |" -E "s|%pid_path%|/logs/nginx.pid|" -E "s|%conf_path%|/conf/nginx.conf|" -E "S|%error_log_path%|/logs/error.log|" < docs/man/nginx.8 > build/nginx.8
' sed ' is not an internal or external command, nor is it a running program
or batch file.
Nmake:fatal error U1077: "sed": Return code "0x1"
Stop
This is because we did not properly configure Msys and Mingw32 on Windows above the path generated, regardless.
Under D:\git\nginx\build\, the Nginx.exe has been successfully generated
4 configuration
CD D:\git\nginx\build
mkdir logs
mkdir Temp
# Modify the configuration of lib\nginx-rtmp-module\test\nginx.conf and specify/path/to as Lib
# Note The system does not occupy TCP 8080 ports, and 1935 ports. 8080 is used by default in nginx.conf as the HTTP port and 1935 as the push-stream port.
# root/path/to/nginx-rtmp-module/test;
Root lib/nginx-rtmp-module/test;
# root/path/to/nginx-rtmp-module/test/www;
Root lib/nginx-rtmp-module/test/www;
5 Testing
# Start Nginx.exe
Nginx.exe-c lib\nginx-rtmp-module\test\nginx.conf
Enter the content in the browser's address bar, and if you have an available camera on your PC, you can see the recording and watching the video stream:
Http://127.0.0.1:8080/index.html
Http://127.0.0.1:8080/rtmp-publisher/player.html
Http://127.0.0.1:8080/rtmp-publisher/publisher.html
http://127.0.0.1:8080/stat/
Windows10 vs2015 compiling 32-bit nginx with Nginx-rtmp-module module