Last active
March 30, 2021 04:57
-
-
Save dd-han/e9a004137a7eacff004fc8137e41c168 to your computer and use it in GitHub Desktop.
Build Nginx on Windows Script (PowerShell)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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