Skip to content

Latest commit

 

History

History
138 lines (137 loc) · 6.21 KB

README.md

File metadata and controls

138 lines (137 loc) · 6.21 KB

Nginx_1.26.0

Nginx Windows版

Ngnix官网的发行版以网段为单位进行数据分发和均衡流量,同局域网内负载均衡便会失效。
现修改为以IP地址为单位,同局域网内有效。
仅提供32Bit编译版。64Bit版编译有丢失精度可能,需要的请自行编译。

The official releases of Nginx distribute and balance traffic by subnet, which renders load balancing ineffective within the same LAN.
We've now modified it to distribute traffic by IP address, which is effective within the same LAN. Only the 32-bit compilation version is provided. Please note that compiling a 64-bit version may result in precision loss, so if needed, please compile it yourself.

一、Source:
http://hg.nginx.org/nginx/archive/release-1.26.0.tar.gz

二、Components:
https://www.openssl.org/source/openssl-3.0.13.tar.gz
https://zlib.net/zlib-1.3.1.tar.gz
https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz

https://github.com/quictls/openssl/archive/refs/tags/openssl-3.0.13-quic1.tar.gz


三、Build Tools:
https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-x86_64-20240507.exe
https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_53822_64bit/strawberry-perl-5.38.2.2-64bit.msi
https://www.mercurial-scm.org/release/tortoisehg/windows/tortoisehg-6.6.3-x64.msi

https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=enterprise&channel=Release&version=VS2022&source=VSLandingPage&cid=2030:3b4d41295538415195deaab9b3b96c68

四、Modify Source:
(1).
Nginx_1.26.0\auto\cc\msvc

A.Line 11

= # MSVC 2010 (10.0) cl 16.00
= # MSVC 2015 (14.0) cl 19.00

= # MSVC 2010 (10.0) cl 16.00
= # MSVC 2015 (14.0) cl 19.00
= # MSVC 2022 (17.9.6) cl 19.39.33523

B.Line 131

= # MSVC 2005 supports C99 variadic macros
= if [ "$ngx_msvc_ver" -ge 14 ]; then

= ngx_msvc_ver=17
= # MSVC 2005 supports C99 variadic macros
= if [ "$ngx_msvc_ver" -ge 14 ]; then

(2).
Nginx_1.26.0\src\http\modules\ngx_http_upstream_ip_hash_module.c:

Line 124、Line 137

iphp->addrlen = 3;

iphp->addrlen = 4;

(3).Compatible with 64-bit compilation, please ignore for 32-bit compilation.
Nginx_1.26.0\auto\lib\openssl\makefile.msvc

“VC-WIN32” replace to “VC-WIN64A”;
perl Configure $(OPENSSL_TARGET) no-shared no-threads \

perl Configure VC-WIN64A no-shared no-threads \

“if exist ms\do_ms.bat” replace to “if exist ms\do_win64a.bat”;
“ms\do_ms” replace to “ms\do_win64a”。

if exist ms\do_ms.bat ( \
ms\do_ms \

if exist ms\do_win64a.bat ( \
ms\do_win64a \

五、Configure:
user@hostname MSYS ~/Nginx_1.26.0
$ auto/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/pcre2-10.39 \
       --with-zlib=objs/lib/zlib-1.3.1 \
       --with-openssl=objs/lib/openssl-3.0.13 \
       --with-openssl-opt=no-asm \
       --with-http_ssl_module
checking for OS

  • MSYS_NT-10.0-22631 3.5.3.x86_64 x86_64
  • using Microsoft Visual C++ compiler
  • cl version:
    checking for MSYS_NT-10.0-22631 specific features
    creating objs/Makefile

Configuration summary
+ using PCRE2 library: objs/lib/pcre2-10.39
+ using OpenSSL library: objs/lib/openssl-3.0.13
+ using zlib library: objs/lib/zlib-1.3.1

nginx path prefix: ""
nginx binary file: "/nginx.exe"
nginx modules path: "/modules"
nginx configuration prefix: "/conf"
nginx configuration file: "/conf/nginx.conf"
nginx pid file: "/logs/nginx.pid"
nginx error log file: "/logs/error.log"
nginx http access log file: "/logs/access.log"
nginx http client request body temporary files: "temp/client_body_temp"
nginx http proxy temporary files: "temp/proxy_temp"
nginx http fastcgi temporary files: "temp/fastcgi_temp"
nginx http uwsgi temporary files: "temp/uwsgi_temp"
nginx http scgi temporary files: "temp/scgi_temp"

user@hostname MSYS ~/Nginx_1.26.0
$

六、Build:(Windows 11 Pro 23H2 + Visual Studio 2022 Enterprise)
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.9.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'

C:\Program Files\Microsoft Visual Studio\2022\Enterprise>cd C:\msys64\home\user\Nginx_1.26.0

C:\msys64\home\user\Nginx_1.26.0>nmake