Compile Nginx source code in Windows

Source: Internet
Author: User

Compile Nginx source code in Windows 1. Open MinGW32 and switch to the current Code directory www.2cto.com 2 ,. /auto/configure-prefix = "c: /nginx "-with-cc-opt ="-D FD_SETSIZE = 4096-D _ NO_MINGW_LFS-D _ WATCOMC _ "-without-http_rewrite_module-without-http_gzip_module since it is downloaded from the SVN Repository source code, the configure file does not exist in the main directory, so use/auto/configure. -Prefix = "c:/nginx" is the installation directory of Nginx. Be sure to write the slash in the path, it must be "/"-D FD_SETSIZE = 4096 to avoid running error prompts-D _ NO_MINGW_LFS to avoid ssize_t and off_t errors during compilation-D _ WATCOMC _ is used to avoid Nginx shmtr errors during compilation because it is a simple example, use-without-http_rewrite_module,-without-http_gzip_module to avoid Nginx dependency on other libraries 3, change objs/Makefile to remove-Werror in objs/Makefile, ignore the warning as an error prompt. Find advapi32.lib and ws2_32.lib in objs/Makefile and complete the path with the following parameters: "C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ Lib \ advapi32.lib" C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ Lib \ ws2_32.lib "4. make 5. make install Nginx is installed in the C:/nginx directory. Use VC to compile Nginx source code in MinGW32. 1. Open MinGW32 and switch to the current Code directory. 2. export PATH = $ PATH: "C: \ Program Files \ Microsoft Visual Studio 10.0 \ VC \ bin ":" C: \ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE ":" C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ bin "to set the current environment variable. Note that the slash must be used in the path ,. /auto/configure-prefix = "c:/nginx"-with-cc = "cl"-with-cc-opt = "-D FD_SETSIZE = 4096-I \" C: /Program Files/Microsoft SDKs/Windows/v7.0A/in Clude \ "-I \" C:/Program Files/Microsoft Visual Studio 10.0/VC/include \ "-without-http_rewrite_module-without-http_gzip_module start configuration, note the slash in the path, make sure to use "/" 4. Change objs/ngx_auto_config.h to escape the quotation marks in the macro definition of the first line, as shown in the following code: # define NGX_CONFIGURE "-prefix = c: /nginx-with-cc = cl-with-cc-opt = '-D FD_SETSIZE = 4096-I \ "C: /Program Files/Microsoft SDKs/Windows/v7.0A/include \ "-I \" C:/Program Files/Microsoft Visual Studio 10. 0/VC/include \ "'-without-http_rewrite_module-without-http_gzip_module" 5, change objs/Makefile in objs/Makefile find kernel32.lib user32.lib advapi32.lib ws2_32.lib, and complete the path, changed to: "C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ Lib \ kernel32.lib "" C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ Lib \ user32.lib "" C: \ Program Files \ Microsoft SDKs \ Windows \ v7.0A \ Lib \ advapi32.lib "C: \ Program Files \ Microsoft SDKs \ Windows \ v7. 0A \ Lib \ ws2_32.lib ". Add two additional paths, for example, "C: \ Program Files \ Microsoft Visual Studio 10.0 \ VC \ lib \ LIBCMT. lib "" C: \ Program Files \ Microsoft Visual Studio 10.0 \ VC \ lib \ oldnames. lib "6, nmake 7, and nmake install, Nginx is installed in the C:/nginx directory. The Nginx program of the Release version is compiled by default. If you need to compile the Debug version, modify the corresponding configurations in auto/cc/gcc and auto/cc/msvc.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.