You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下编译带HTTP/3的NGINX遇NMAKE U1077错误求助

Windows下编译带HTTP/3的Nginx报错排查与修正

问题背景

作为Nginx新手,要启用非内置的HTTP/3模块,需源码编译。参照旧Windows编译视频操作,下载了Nginx 1.25.4和OpenSSL 3.0.13,执行auto/configure生成Makefile后,运行nmake /f objs\MakeFile编译报错。

错误原因及修正方案

结合Windows环境编译Nginx+HTTP/3的常见问题,你的操作主要存在以下几点问题,对应修正如下:

1. OpenSSL版本兼容性问题

Nginx 1.25.x在Windows环境下搭配OpenSSL 3.0.x易出现编译兼容问题,HTTP/3依赖的QUIC特性在OpenSSL 1.1.1系列(如1.1.1w)中更稳定,建议替换为该版本。

2. _WIN32_WINNT版本设置错误

你配置中--with-openssl-opt里的-D_WIN32_WINNT=0x0501对应Windows XP,但Nginx 1.25.x已不再支持XP,最低要求为Windows 7(对应0x0601),该设置会导致系统API不兼容报错,需修改为:

--with-openssl-opt="no-asm no-tests -D_WIN32_WINNT=0x0601"

3. 依赖库路径与版本匹配

配置中指定的--with-pcre=objs/lib/pcre-8.44建议更换为PCRE 8.45(与Nginx 1.25.x兼容性更好),同时确保PCRE、zlib均已正确解压到对应路径,目录名与配置中的完全一致,无拼写错误。

4. 编译环境选择错误

务必使用Visual Studio对应版本的x64 Native Tools Command Prompt编译,HTTP/3在64位环境下更稳定,避免32位环境的内存限制问题。

修正后的完整configure命令

替换依赖版本、调整编译选项后的命令如下:

./auto/configure ^
        --with-cc=cl ^
        --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-pcre=objs/lib/pcre-8.45 ^
        --with-zlib=objs/lib/zlib-1.3.1 ^
        --with-http_v2_module ^
        --with-http_v3_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/lib/openssl-1.1.1w ^
        --with-openssl-opt="no-asm no-tests -D_WIN32_WINNT=0x0601" ^
        --with-http_ssl_module ^
        --with-mail_ssl_module ^
        --with-stream_ssl_module

额外注意事项

  • 执行configure前,确认所有依赖库(PCRE、zlib、OpenSSL)已解压到objs/lib/对应目录,目录名称与配置完全匹配;
  • 若仍报错,可查看objs/autoconf.err日志,获取更详细的编译错误信息。

内容的提问来源于stack exchange,提问作者Kartic Joshi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 05:50:40