惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Schneier on Security
Schneier on Security
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
罗磊的独立博客
小众软件
小众软件
H
Help Net Security
Vercel News
Vercel News
M
MIT News - Artificial intelligence
雷峰网
雷峰网
Stack Overflow Blog
Stack Overflow Blog
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Heimdal Security Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
B
Blog
Forbes - Security
Forbes - Security
T
Troy Hunt's Blog
月光博客
月光博客
The Cloudflare Blog
Last Week in AI
Last Week in AI
J
Java Code Geeks
Jina AI
Jina AI
TaoSecurity Blog
TaoSecurity Blog
Google Online Security Blog
Google Online Security Blog
C
Check Point Blog
PCI Perspectives
PCI Perspectives
SecWiki News
SecWiki News
P
Proofpoint News Feed
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Last Watchdog
The Last Watchdog
F
Full Disclosure
T
Threatpost
NISL@THU
NISL@THU
量子位
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
F
Fortinet All Blogs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队

秋水逸冰

丽萨主机:双ISP家宽住宅IP VPS/CN2 GIA精品网/G口大带宽 | 秋水逸冰 Linux Kernel 6.18.x 编译版 | 秋水逸冰 思考未来人与 AI 的关系 | 秋水逸冰 3X-UI 面板安装和使用教程 | 秋水逸冰 Xray-UI 面板安装和使用教程 | 秋水逸冰 WCMP (Windows + Caddy + MariaDB + PHP) Aria2 for Windows | 秋水逸冰 Curl for Windows | 秋水逸冰 Wget for Windows | 秋水逸冰 Windows 11 Enterprise LTSC DD 镜像 Windows Server 2025 Datacenter DD 镜像 重新编译 curl 以支持 HTTP3 | 秋水逸冰 tiny10 和 tiny11 23H2 的 Windows DD 镜像 从 Apache httpd 切换到 Caddy2 LCMP (Linux + Caddy + MariaDB + PHP) Windows 11 Pro for Workstations 22H2 DD 镜像 Shadowsocks 编译版 by Teddysun | 秋水逸冰 适用于 UEFI 启动的多个 Windows 系统 DD 镜像 Linux Kernel 5.15.x 编译版 | 秋水逸冰 制作适用于 WSL 的任意 Linux 镜像 Windows 11 Pro for Workstations 21H2 DD 镜像 Windows 10 Enterprise LTSC DD 镜像 Linux Kernel 5.14.x 编译版 | 秋水逸冰 Linux Kernel 5.13.x 编译版 | 秋水逸冰 Windows Server 2022 Datacenter DD 镜像 在 Windows 10 上安装 Rocky Linux 系统 Linux Kernel 5.12.x 编译版 | 秋水逸冰 Linux Kernel 5.11.x 编译版 | 秋水逸冰 在 Windows 10 上安装 CentOS 系统 Linux Kernel 5.10.x 编译版 | 秋水逸冰 Caddy v1.0.5 编译版 | 秋水逸冰 在 Windows 系统里轻松创建自定义服务 | 秋水逸冰 如何在 CentOS 8 下安装 Docker Engine 在 CentOS 7 下构建 Android 编译环境 使用 Docker Buildx 构建多种系统架构镜像 | 秋水逸冰 使用 Docker 快速部署 Shadowsocks-libev + v2ray-plugin 如何使用 FirewallD 开启 IP 白名单 WireGuard 一键安装脚本 | 秋水逸冰 域名那些事儿5 | 秋水逸冰 告别 | 秋水逸冰 Windows Server 2019/2016/2012R2 Datacenter DD 镜像 如何制作 Windows Server 2019 的 DD 镜像 介绍几款 Docker 镜像 | 秋水逸冰 如何启用 Shadowsocks 的多端口 | 秋水逸冰 一键安装KMS服务脚本 | 秋水逸冰 关于免费SSL证书的那些事儿 | 秋水逸冰 使用定时任务cron监视Shadowsocks进程 | 秋水逸冰 LAMP新增Letsencrypt支持 | 秋水逸冰 从编译到二进制安装 | 秋水逸冰 PHP模块一览及简要说明 | 秋水逸冰 使用 GPG 加密 Github Commits 一键安装最新内核并开启 BBR 脚本 | 秋水逸冰 Shadowsocks 一键安装脚本(四合一) | 秋水逸冰 FTP 上传一键脚本ftp_upload.sh | 秋水逸冰 限制 IP 访问 WordPress 登录画面 CentOS 6.10安装Python2.7.18 | 秋水逸冰 一键备份脚本backup.sh | 秋水逸冰 域名那些事儿4 | 秋水逸冰 域名那些事儿3 | 秋水逸冰 LAMP下SSL设置教程 | 秋水逸冰 L2TP/IPSec一键安装脚本 | 秋水逸冰 域名那些事儿2 | 秋水逸冰 一键测试脚本bench.sh | 秋水逸冰 解决pip安装M2Crypto失败的问题 | 秋水逸冰 在CentOS下编译安装GCC | 秋水逸冰 域名那些事儿 | 秋水逸冰 MySQL性能优化的简单说明 | 秋水逸冰 Zend Guard Loader简介及下载链接一览 | 秋水逸冰 Windows和Linux下Whois命令的安装和使用 | 秋水逸冰 LAMP一键安装脚本使用说明 | 秋水逸冰 Windows系统下安装dig命令 | 秋水逸冰 如何在Debian下安装Webmin | 秋水逸冰 Apache下部署SSL教程 | 秋水逸冰 Shadowsocks-go一键安装脚本 | 秋水逸冰 少壮不努力,一生在内地 | 秋水逸冰 Google日语输入法离线安装包 | 秋水逸冰 PHP加速缓存Zend Opcache | 秋水逸冰 CentOS下安装aria2教程 | 秋水逸冰 Linux多线程下载工具Axel | 秋水逸冰 phpMyAdmin导入文件错误的解决办法 | 秋水逸冰 PHP编译安装常见错误总结 | 秋水逸冰 phpMyAdmin从4.1.x升级到4.2.x注意事项 | 秋水逸冰 Debian下shadowsocks-libev一键安装脚本 | 秋水逸冰 CentOS下shadowsocks-libev一键安装脚本 | 秋水逸冰 又一家VPS:Vultr.com | 秋水逸冰 Linux系统中常用操作命令 | 秋水逸冰 Eclipse下搭建Python开发环境 | 秋水逸冰 Shadowsocks Python版一键安装脚本 | 秋水逸冰 Git初学者:msysgit和tortoisegit | 秋水逸冰 CentOS 6下编译PHP出错 | 秋水逸冰 Apache如何开启Gzip压缩 | 秋水逸冰 Linux Shell逻辑运算符和表达式详解 | 秋水逸冰 吐槽腾讯:PC用户也是用户 | 秋水逸冰 Webmin:如何安装Perl模块DBI和DBD-MySQL | 秋水逸冰 CentOS下如何手动添加Swap | 秋水逸冰 安装PHP的PDO MySQL扩展 | 秋水逸冰 Javascript获取URL参数值 | 秋水逸冰 总结我所用过的VPS商家 | 秋水逸冰 Apache索引(目录浏览)的那些事儿 | 秋水逸冰 如何新建最低权限的SSH帐号 | 秋水逸冰
Nginx for Windows | 秋水逸冰
秋水逸冰 · 2026-01-18 · via 秋水逸冰

技术 秋水逸冰 3821浏览 0评论

Nginx 官方网站提供的 Windows 版本也是可以直接适用于 Windows 系统的。
本文提供的 Nginx 区别于上述官方版,是利用 MSYS2 环境 gcc compiler 自行编译的,并不是使用 Microsoft Visual C compiler(Microsoft Visual Studio)。

1. 版本号

Nginx 版本 1.31.1

nginx version: nginx/1.31.1
built by gcc 16.1.0 (Rev5, Built by MSYS2 project)
built with OpenSSL 3.5.7 9 Jun 2026
TLS SNI support enabled
configure arguments: --with-cc=cc --builddir=objs --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-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-stream_realip_module --with-stream_ssl_preread_module --with-pcre=objs/lib/pcre2-10.47 --with-zlib=objs/lib/zlib-1.3.2 --with-openssl=objs/lib/openssl-3.5.7 --with-openssl-opt='no-asm no-tests no-makedepend -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

截图的版本是 nginx-1.29.4.zip

2. 如何在 MSYS2 环境编译 Nginx

先来看看官方版本的编译选项:

configure arguments: --with-cc=cl --builddir=objs.msvc8 --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.msvc8/lib/pcre2-10.47 --with-zlib=objs.msvc8/lib/zlib-1.3.2 --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-stream_realip_module --with-stream_ssl_preread_module --with-openssl=objs.msvc8/lib/openssl-3.5.6 --with-openssl-opt='no-asm no-tests no-makedepend -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

这些选项基本都可以沿用。我在编译时,将编译器换成 gcc 了,同时升级了 pcre2 到版本 10.47。
编译前的准备:
安装 MSYS2,以及 GCC 编译器等。此过程略过不提。
编译过程如下:
打开 MSYS2 MINGW64 的 shell 窗口。
下载并解压所需软件。

curl -Lo nginx-1.31.1.tar.gz https://nginx.org/download/nginx-1.31.1.tar.gz
curl -Lo openssl-3.5.7.tar.gz https://github.com/openssl/openssl/releases/download/openssl-3.5.7/openssl-3.5.7.tar.gz
curl -Lo pcre2-10.47.tar.gz https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.47/pcre2-10.47.tar.gz
curl -Lo zlib-1.3.2.tar.gz https://www.zlib.net/zlib-1.3.2.tar.gz
tar -xzf nginx-1.31.1.tar.gz
cd nginx-1.31.1
mkdir -pv objs/lib
tar -xzf ../pcre2-10.47.tar.gz -C objs/lib
tar -xzf ../zlib-1.3.2.tar.gz -C objs/lib
tar -xzf ../openssl-3.5.7.tar.gz -C objs/lib

编译选项:

./configure \
    --with-cc=cc \
    --builddir=objs \
    --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-http_v2_module \
    --with-http_realip_module \
    --with-http_addition_module \
    --with-http_sub_module \
    --with-http_dav_module \
    --with-http_stub_status_module \
    --with-http_flv_module \
    --with-http_mp4_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_auth_request_module \
    --with-http_random_index_module \
    --with-http_secure_link_module \
    --with-http_slice_module \
    --with-mail \
    --with-stream \
    --with-stream_realip_module \
    --with-stream_ssl_preread_module \
    --with-pcre=objs/lib/pcre2-10.47 \
    --with-zlib=objs/lib/zlib-1.3.2 \
    --with-openssl=objs/lib/openssl-3.5.7 \
    --with-openssl-opt='no-asm no-tests no-makedepend -D_WIN32_WINNT=0x0501' \
    --with-http_ssl_module \
    --with-mail_ssl_module \
    --with-stream_ssl_module

接下来使用 make 命令编译,-j 后的数字与 CPU 核数一致即可:

make -j8

编译完成后,安装到指定目录:

mkdir -pv /home/user/nginx
make DESTDIR=/home/user/nginx install

接着使用 strip 命令删除二进制文件中所有调试符号,以减少文件大小

cd /home/user/nginx
strip nginx.exe

一些已知问题,参照这里
虽然可以启动多个 workers,但实际上只有一个 worker 在工作。
不支持 UDP(以及本质上的 QUIC)功能,也就是 --with-http_v3_module 编译选项不可用。

3. 下载已经编译好的二进制文件

2026 年 6 月 11 日更新到 1.31.1 版本。
下载地址:
https://dl.lamp.sh/files/nginx-1.31.1.zip
文件 nginx-1.31.1.zip 的属性
Size: 3047053 byte,3.0 MB
md5sum: e3b479ce5d47361315da5f39a0db6098
sha1sum: 2a6e14bdd5413b2827650f3c9c9614cc559d93bd
sha256sum: fe963fe6634387bb83fb993514633ecbb64c72081ef9b8a231b97bd37473d3bd

2026 年 5 月 20 日更新到 1.31.0 版本。
下载地址:
https://dl.lamp.sh/files/nginx-1.31.0.zip
文件 nginx-1.31.0.zip 的属性
Size: 3045080 byte,3.0 MB
md5sum: 293ba72ca637f651386d2cf15c51d763
sha1sum: c3932d34aaf74e8a5ca807dd58368ed93ebe103f
sha256sum: 7a36388928cf8ca16db05b179fb59ebdc7795013b461024a5ab76c81d3e49130

2026 年 4 月 15 日更新到 1.29.8 版本。
下载地址:
https://dl.lamp.sh/files/nginx-1.29.8.zip
文件 nginx-1.29.8.zip 的属性
Size: 3015566 byte,2.9 MB
md5sum: ab39bbc07121eb7c235a91ee655ca4aa
sha1sum: 86cec3212b0ff0d6dcdc93add5b5492a5183687c
sha256sum: ce8fbd4a367abcb9aa2bf9a05d0c015082a6125a7fb20d4719460263f4089d1a

2026 年 2 月 5 日更新到 1.29.5 版本。
下载地址:
https://dl.lamp.sh/files/nginx-1.29.5.zip
文件 nginx-1.29.5.zip 的属性
Size: 3007568 byte,2.9 MB
md5sum: 30fc92d222256a5ac9e4edcf751bb71a
sha1sum: 74573be5807ea7dd43edca9cdd00f30f159137e1
sha256sum: 19e33cba8ba2ee3e48ec8c4a771693db52a6950294b7f8ac0244ba168e3c0722

https://dl.lamp.sh/files/nginx-1.29.4.zip
文件 nginx-1.29.4.zip 的属性
Size: 3003629 byte,2.9 MB
md5sum: 81535102beb53e16efb5a4833881f16c
sha1sum: d2dc7fe38d504ddafdeafb48dbd4cdeef6e175a9
sha256sum: d432232bd9770c0e56ea192660b85410141cbdf050db68db99ba760b6bf3ce2d

截图的版本是 nginx-1.29.4.zip

同时编译了其另一个分支 freenginx

nginx version: freenginx/1.31.2
built by gcc 16.1.0 (Rev5, Built by MSYS2 project)
built with OpenSSL 3.5.7 9 Jun 2026
TLS SNI support enabled
configure arguments: --with-cc=cc --builddir=objs --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-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-stream_realip_module --with-stream_ssl_preread_module --with-pcre=objs/lib/pcre2-10.47 --with-zlib=objs/lib/zlib-1.3.2 --with-openssl=objs/lib/openssl-3.5.7 --with-openssl-opt='no-asm no-tests no-makedepend -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

下载地址:
https://dl.lamp.sh/files/freenginx-1.31.2.zip
文件 freenginx-1.31.2.zip 的属性
Size: 3005675 byte,2.9 MB
md5sum: be433790a5d863d593a0ad7793768c45
sha1sum: df579ac2d650ec50821e024e4d517c2641403659
sha256sum: c162d9c01056f7556295f10823eff48f8fd7e6295f2dbbbb2548c211768ca2f3

下载地址:
https://dl.lamp.sh/files/freenginx-1.31.1.zip
文件 freenginx-1.31.1.zip 的属性
Size: 3004965 byte,2.9 MB
md5sum: b88d805a7532a0cf602fedff11fe9e31
sha1sum: 422962f6e01ed564090114078f991b5a281fe0b3
sha256sum: 0637aef74ae1dc460d6c50fa578c30f1cb926ea2ffa8051a71ec2aa2cd5422a7

https://dl.lamp.sh/files/freenginx-1.29.5.zip
文件 freenginx-1.29.5.zip 的属性
Size: 2988210 byte,2.9 MB
md5sum: 1effbd8bb279be5d7d5a728bcceda1c9
sha1sum: 88b6cecbd550d909e06e34ededc518b682e1d8a5
sha256sum: f861e1f44049b3b230c5dc8016692e2c4e5947be25b0610aa54058acbf6cae6a

https://dl.lamp.sh/files/freenginx-1.29.4.zip
文件 freenginx-1.29.4.zip 的属性
Size: 2974879 byte,2.9 MB
md5sum: c0b156933ffe556e9a97e05e2951a79c
sha1sum: 88fa63cda7aecccf8f9b60db84a2fe934ad4e035
sha256sum: 9177fb01e5fbf004781871656672af46b931b231b1751fe27a501f78aa623dbf

截图的版本是 freenginx-1.29.4.zip

写在最后

请关注我的 Telegram 频道:https://t.me/qiushuiyibing
我会在此不定期发布一些杂七杂八的作品。
同时也欢迎加入交流群:https://t.me/qiushui2018

转载请注明:秋水逸冰 » Nginx for Windows