Skip to content

Instantly share code, notes, and snippets.

@nvtienanh
Created October 29, 2021 15:37
Show Gist options
  • Save nvtienanh/df7e56e03c82df12598cd41b9ff7189b to your computer and use it in GitHub Desktop.
Save nvtienanh/df7e56e03c82df12598cd41b9ff7189b to your computer and use it in GitHub Desktop.
Compile NGINX from source code on Windows 11

Install tools

Library for Nginx

Commands

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.44 \
    --with-zlib=objs/lib/zlib-1.2.11 \
    --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-openssl=objs/lib/openssl-1.1.1l \
    --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501' \
    --with-http_ssl_module \
    --with-mail_ssl_module \
    --with-stream_ssl_module

Build command

nmake /f objs\MakeFile

https://www.youtube.com/watch?v=M-cj-p4rZtU

@jangotek
Copy link

jangotek commented Sep 15, 2022

For rtmp i found it here https://www.programmerall.com/article/57161186230/
if you need headers-more for windows: https://github.com/ewwink/headers-more-nginx-module-for-windows
i have a compiled nginx 64-bit with headers-more module, updated pcre,zlib and openssl : https://github.com/palaboy/nginx

@Broukmiken
Copy link

For rtmp i found it here https://www.programmerall.com/article/57161186230/ if you need headers-more for windows: https://github.com/ewwink/headers-more-nginx-module-for-windows i have a compiled nginx 64-bit with headers-more module, updated pcre,zlib and openssl : https://github.com/palaboy/nginx

Thanks.
I finally found how to do it myself and for 32 ans 64 bits.
And made 2 vidéos on YouTube explaining in a step bye step how to do it
Cheers
Fred

@blackrussian84
Copy link

Hi, new to adding modules ... trying to add spnego-http-auth-nginx-module on windows using cygwin ... with no success

@hrishige
Copy link

hrishige commented Sep 1, 2023

Hi would you know how to build perl scripts into nginx within the same environment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment