Http://nginx.org/en/docs/howto_build_on_win32.html
Operating instructions on the official website.
Official Website Method Nginx compilation method, the idea is consistent, but there are a few details where need to adjust.
The following issues need to be noted:
- WIN10 operating system, it seems that there is a problem when compiling OpenSSL.
- Use SM for Windows as an alternative to Microsoft's MASM.
One: Download the following tools and install them in turn.
1, download VS2010 + VS2010 SP1 (c + + compilation Environment) VS2015 can also.
2, Msys-1.0.11.exe
3, Activeperl-5.24.2.2403-mswin32-x64-403863.exe
4, Mercurial-4.3.1-x64.msi
5, Nasm-2.12.02rc9-installer-x64.exe
6, Sed-4.2.1-setup.exe
7, download the matching required library code pcre, zlib and OpenSSL libraries sources.
And you need to ensure that the above tools are added to the environment variables.
Second, get Nginx source code
Open the cmd command, switch to the mercurial installation root directory, and execute the command:
HG Clone Http://hg.nginx.org/nginx
After the download is successful, the Nginx source folder is created in the mercurial installation directory.
Iii. adding dependent resource bundles
In the Nginx source code to create the Objs\lib folder, where this name is only the convention of the custom, can not be the two names. And the downloaded Nginx-rtmp-module-master, OpenSSL, Pcre, zlib respectively extracted under the Lib folder.
The above actions can be the same as the official website tutorial, using Msys using Cui way.
Results such as:
Iv. generating a Makefile file for C + + compilers
Continue using the Msys tool, return to the Nginx source code root directory, execute the following script:
Auto/configure--with-cc=cl--builddir=objs--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.41 \
--with-zlib=objs/lib/zlib-1.2.11--with-openssl=objs/lib/openssl-1.0.2k \
--with-select_module--with-http_ssl_module--add-module=objs/lib/nginx-rtmp-module
Like the last three parts of the output
The end result is that the makefile file is generated in the Objs directory, along with other dependent code.
V. The pit of OpenSSL,
The nginx\auto\lib\openssl\makefile.msvc file needs to be modified.
Change Ms\do_ms to Ms\do_nasm.
See article for specific reasons.
Http://blog.csdn.net/felixking/article/details/51981794?utm_source=itdadao&utm_medium=referral
Six, compile Nginx source code
Using the VS2010 command tool, switch to the Nginx root directory and execute the nmake-f objs/makefile command.
"I started using VS2015 developer Tools on the Wi10, and the results were still problematic, for reasons not analyzed, the core error is as follows:
Perl util/copy.pl "inc32\openssl\*. [CH] "" D:\Program Files\mercurial\nginx\objs\lib\openssl-1.0.2k\openssl\include\openssl "
Destination must is a directory at util/copy.pl line 39.
Presumably the WIN10 version has this exception "
Finally, change to win7+vs2010.
After a long wait, the exciting moment comes. Compilation succeeded.
Vii. creating a running Base folder
Create a conf,logs,temp,tmp directory under the folder where Nginx.exe is located, and you can nginx-rtmp-module\ The nginx.conf file under test is copied to the Conf directory, and the basic RTMP streaming service is built.
Windows compiler Nginx-rtmp-module