Clone
1
Compile Guide
iamdoubz edited this page 2025-02-10 16:47:00 -06:00

freenginx for Windows

Prerequisites

Download, install and restart computer

  1. Git for Windows
  2. Strawberry Perl
  3. Visual Studio 2022 (Desktop development with C++)

Download and extract

  1. PCRE2
  2. zlib
  3. OpenSSL
  4. OpenResty Headers-More

Compile steps

  1. Download source: https://freenginx.org/download/freenginx-1.27.4.tar.gz
  2. Extract: tar -xzf freenginx-1.27.4.tar.gz && rm freenginx-1.27.4.tar.gz or use 7zip or similar software to extract...
  3. In Git for Windows, Configure:
./configure --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --build="w/free,H2,Stream,Headers-More,debug" --conf-path=conf/nginx.conf --pid-path=temp/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=cache/client_body_temp --http-proxy-temp-path=cache/proxy_temp --http-fastcgi-temp-path=cache/fastcgi_temp --http-scgi-temp-path=cache/scgi_temp --http-uwsgi-temp-path=cache/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-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-pcre=../pcre2-10.44 --with-zlib=../zlib-1.3.1 --with-openssl=../openssl-3.3.2 --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501' --add-module=../headers-more-nginx-module-0.38
  1. Edit Makefile: nano objs.msvc8/Makefile
  2. Change CC from CC = cl to CC = cl /MP
  3. Change CFLAGS from CFLAGS = -O2 -W4 -WX -nologo -MT -Zi -Fdobjs.msvc8/nginx.pdb -DFD_SETSIZE=1024 -DNO_SYS_TYPES_H to CFLAGS = -O2 -W4 -nologo -MT -Zi -Fdobjs.msvc8/nginx.pdb -DFD_SETSIZE=1024 -Y- -wd4127 -wd4189 -wd4201 -wd4334 -wd4702 -DNO_SYS_TYPES_H
  4. Launch x64 Native Tools Command Prompt for VS 2022
  5. cd /path/to/source/in/step/2
  6. Compile: nmake > log.txt
  7. Wait a long time ~5-10 minutes
  8. Verify binary: cd objs.msvc8 && nginx -V
nginx version: nginx/1.27.4 (w/H2,Stream,Headers-More,debug)
built by cl
built with OpenSSL 3.3.2 3 Sep 2024
TLS SNI support enabled
configure arguments: --with-cc=cl...
...