Skip to content

Instantly share code, notes, and snippets.

@dd-han dd-han/build-nginx.ps1
Last active Sep 24, 2018

Embed
What would you like to do?
Build Nginx on Windows Script (PowerShell)
$PCRE_VERSION='8.42'
$ZLIB_VERSION='1.2.11'
$OPENSSL_VERSION='1.0.2p'
$NGINX_VERSION='release-1.15.3'
$NGINX_RTMP_VERSION='master'
# using standlone minGW
#$MSYS_PATH='C:\MinGW\msys\1.0\bin'
# using gitbash
$MSYS_PATH='C:\Program Files\Git\usr\bin'
$env:Path += ';' + $MSYS_PATH
Start-BitsTransfer -Source https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.tar.gz -Destination pcre-${PCRE_VERSION}.tar.gz
Start-BitsTransfer -Source http://zlib.net/zlib-${ZLIB_VERSION}.tar.gz -Destination zlib-${ZLIB_VERSION}.tar.gz
Start-BitsTransfer -Source https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -Destination openssl-${OPENSSL_VERSION}.tar.gz
git clone https://github.com/arut/nginx-rtmp-module.git
cd nginx-rtmp-module
git checkout $NGINX_RTMP_VERSION
cd ..
hg clone http://hg.nginx.org/nginx
cd nginx
hg checkout $NGINX_VERSION
mkdir objs
mkdir objs/lib
cd objs/lib
tar -xzf ../../../pcre-${PCRE_VERSION}.tar.gz
tar -xzf ../../../zlib-${ZLIB_VERSION}.tar.gz
tar -xzf ../../../openssl-${OPENSSL_VERSION}.tar.gz
cd ..\..\
bash auto/configure "--with-cc=cl",
"--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-${PCRE_VERSION}",
"--with-zlib=objs/lib/zlib-${ZLIB_VERSION}",
"--with-openssl=objs/lib/openssl-${OPENSSL_VERSION}",
"--with-openssl-opt=no-asm",
"--with-select_module",
"--with-http_ssl_module",
"--with-select_module",
"--with-http_ssl_module",
"--add-module=../nginx-rtmp-module"
nmake
cd ..
mkdir target
cd target
copy ..\nginx\objs\nginx.exe .
mkdir conf
copy ..\nginx\conf\* conf\
mkdir html
copy ..\nginx\docs\html\* html\
mkdir logs
mkdir temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.