view xml/en/docs/howto_build_on_win32.xml @ 3054:0083dce686ec

Free nginx: repository links. Repositories are now under freenginx.org/hg/. Only essential repositories are preserved for now: in particular, dev examples are no longer provided, so the relevant section from the devguide was removed.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 14 Feb 2024 20:07:38 +0300
parents f55e18559df9
children
line wrap: on
line source

<?xml version="1.0"?>

<!--
  Copyright (C) Nginx, Inc.
  -->

<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">

<article name="Building nginx on the Win32 platform with Visual C"
         link="/en/docs/howto_build_on_win32.html"
         lang="en"
         rev="27">

<section name="Prerequisites">

<para>
To build nginx on the <registered>Microsoft Win32</registered> platform you need:

<list type="bullet">

<listitem>
Microsoft Visual C compiler. <registered>Microsoft Visual Studio</registered>
8 and 10 are known to work.
</listitem>

<listitem>
<link url="https://sourceforge.net/projects/mingw/files/MSYS/">MSYS</link> or
<link url="https://www.msys2.org">MSYS2</link>.
</listitem>

<listitem>
Perl, if you want to build <registered>OpenSSL</registered> and nginx with SSL support.
For example <link url="http://www.activestate.com/activeperl">ActivePerl</link>
or <link url="http://strawberryperl.com">Strawberry Perl</link>.
</listitem>

<listitem>
<link url="https://www.mercurial-scm.org">Mercurial</link> client.
</listitem>

<listitem>
<link url="http://www.pcre.org">PCRE</link>, <link url="http://zlib.net">zlib</link>
and <link url="http://www.openssl.org">OpenSSL</link> libraries sources.
</listitem>
</list>

</para>

</section>

<section id="build_steps"
         name="Build steps">

<para>
Ensure that paths to Perl, Mercurial and MSYS bin directories are added to
PATH environment variable before you start build. To set Visual C environment
run vcvarsall.bat script from Visual C directory.
</para>

<para>

To build nginx:
<list type="bullet">

<listitem>
Start MSYS bash.
</listitem>

<listitem>
Check out nginx sources from the freenginx.org/hg/nginx repository.
For example:
<programlisting>
hg clone http://freenginx.org/hg/nginx
</programlisting>
</listitem>

<listitem>
Create a build and lib directories, and unpack zlib, PCRE and OpenSSL libraries
sources into lib directory:
<programlisting>
mkdir objs
mkdir objs/lib
cd objs/lib
tar -xzf ../../pcre2-10.39.tar.gz
tar -xzf ../../zlib-1.3.tar.gz
tar -xzf ../../openssl-3.0.10.tar.gz
</programlisting>
</listitem>

<listitem>
Run configure script:
<programlisting>
auto/configure \
    --with-cc=cl \
    --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/pcre2-10.39 \
    --with-zlib=objs/lib/zlib-1.3 \
    --with-openssl=objs/lib/openssl-3.0.10 \
    --with-openssl-opt=no-asm \
    --with-http_ssl_module
</programlisting>
</listitem>

<listitem>
Run make:
<programlisting>
nmake
</programlisting>
</listitem>


</list>

</para>

</section>

<section id="see_also"
         name="See also">

<para>
<list type="bullet">

<listitem>
<link doc="windows.xml"/>
</listitem>

</list>
</para>

</section>
</article>