view xml/en/docs/configure.xml @ 1878:127ae107e5a9

Removed clause about shared memory and Windows versions with ASLR. Starting with nginx 1.9.0 shared memory can be used on Windows versions with address space layout randomization.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 26 Dec 2016 19:38:06 +0300
parents 153a99d25210
children d011ffde3760
line wrap: on
line source

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

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

<article name="Building nginx from Sources"
         link="/en/docs/configure.html"
         lang="en"
         rev="7">

<section>

<para>
The build is configured using the <command>configure</command> command.
It defines various aspects of the system, including the methods nginx
is allowed to use for connection processing.
At the end it creates a <path>Makefile</path>.
The <command>configure</command> command supports the following parameters:
<list type="bullet">

<listitem>
<para>
<literal>--prefix=<value>path</value></literal>&mdash;defines
a directory that will keep server files.
This same directory will also be used for all relative paths set by
<command>configure</command> (except for paths to libraries sources)
and in the <path>nginx.conf</path> configuration file.
It is set to the <path>/usr/local/nginx</path> directory by default.
</para>
</listitem>

<listitem>
<para>
<literal>--sbin-path=<value>path</value></literal>&mdash;sets
the name of an nginx executable file.
This name is used only during installation.
By default the file is named
<path><value>prefix</value>/sbin/nginx</path>.
</para>
</listitem>

<listitem>
<para>
<literal>--conf-path=<value>path</value></literal>&mdash;sets
the name of an <path>nginx.conf</path> configuration file.
If needs be, nginx can always be started with a different configuration file,
by specifying it in the command-line parameter
<nobr><literal>-c <value>file</value></literal></nobr>.
By default the file is named
<path><value>prefix</value>/conf/nginx.conf</path>.
</para>
</listitem>

<listitem>
<para>
<literal>--pid-path=<value>path</value></literal>&mdash;sets
the name of an nginx.pid file that will store the process ID
of the main process.
After installation, the file name can always be changed in the
<path>nginx.conf</path> configuration file using the
<link doc="ngx_core_module.xml" id="pid"/> directive.
By default the file is named
<path><value>prefix</value>/logs/nginx.pid</path>.
</para>
</listitem>

<listitem>
<para>
<literal>--error-log-path=<value>path</value></literal>&mdash;sets
the name of the primary error, warnings, and diagnostic file.
After installation, the file name can always be changed in the
<path>nginx.conf</path> configuration file using the
<link doc="ngx_core_module.xml" id="error_log"/> directive.
By default the file is named
<path><value>prefix</value>/logs/error.log</path>.
</para>
</listitem>

<listitem>
<para>
<literal>--http-log-path=<value>path</value></literal>&mdash;sets
the name of the primary request log file of the HTTP server.
After installation, the file name can always be changed in the
<path>nginx.conf</path> configuration file using the
<link doc="http/ngx_http_log_module.xml" id="access_log"/> directive.
By default the file is named
<path><value>prefix</value>/logs/access.log</path>.
</para>
</listitem>

<listitem>
<para>
<literal>--user=<value>name</value></literal>&mdash;sets
the name of an unprivileged user whose credentials will be used
by worker processes.
After installation, the name can always be changed in the
<path>nginx.conf</path> configuration file using the
<link doc="ngx_core_module.xml" id="user"/> directive.
The default user name is nobody.
</para>
</listitem>

<listitem>
<para>
<literal>--group=<value>name</value></literal>&mdash;sets
the name of a group whose credentials will be used
by worker processes.
After installation, the name can always be changed in the
<path>nginx.conf</path> configuration file using the
<link doc="ngx_core_module.xml" id="user"/> directive.
By default, a group name is set to the name of an unprivileged user.
</para>
</listitem>

<listitem>
<para>
<literal>--with-select_module</literal><br/>
<literal>--without-select_module</literal>&mdash;enables or disables
building a module that allows the server to work with the
<c-func>select</c-func> method.
This module is built automatically if the platform does not appear
to support more appropriate methods such as kqueue, epoll, or /dev/poll.
</para>
</listitem>

<listitem>
<para>
<literal>--with-poll_module</literal><br/>
<literal>--without-poll_module</literal>&mdash;enables or disables
building a module that allows the server to work with the
<c-func>poll</c-func> method.
This module is built automatically if the platform does not appear
to support more appropriate methods such as kqueue, epoll, or /dev/poll.
</para>
</listitem>

<listitem>
<para>
<literal>--without-http_gzip_module</literal>&mdash;disables building a module
that <link doc="http/ngx_http_gzip_module.xml">compresses responses</link>
of an HTTP server.
The zlib library is required to build and run this module.
</para>
</listitem>

<listitem>
<para>
<literal>--without-http_rewrite_module</literal>&mdash;disables building a
module that allows an HTTP server to
<link doc="http/ngx_http_rewrite_module.xml">redirect requests and change URI
of requests</link>.
The PCRE library is required to build and run this module.
</para>
</listitem>

<listitem>
<para>
<literal>--without-http_proxy_module</literal>&mdash;disables building an
HTTP server <link doc="http/ngx_http_proxy_module.xml">proxying module</link>.
<!--
The MD5 library is required to build and run this module.
-->
</para>
</listitem>

<listitem>
<para>
<literal>--with-http_ssl_module</literal>&mdash;enables building a module
that adds the <link doc="http/ngx_http_ssl_module.xml">HTTPS protocol
support</link> to an HTTP server.
This module is not built by default.
The OpenSSL library is required to build and run this module.
</para>
</listitem>

<listitem>
<para>
<literal>--with-pcre=<value>path</value></literal>&mdash;sets
the path to the sources of the PCRE library.
The library distribution (version
4.4&mdash;8.39) needs to be downloaded from the
<link url="http://www.pcre.org">PCRE</link> site and extracted.
The rest is done by nginx’s <command>./configure</command> and
<command>make</command>.
The library is required for regular expressions support in the
<link doc="http/ngx_http_core_module.xml" id="location"/> directive
and for the
<link doc="http/ngx_http_rewrite_module.xml">ngx_http_rewrite_module</link>
module.
</para>
</listitem>

<listitem>
<para>
<literal>--with-pcre-jit</literal>&mdash;builds the PCRE library with
“just-in-time compilation” support (1.1.12, the
<link doc="ngx_core_module.xml" id="pcre_jit"/> directive).
</para>
</listitem>

<listitem>
<para>
<literal>--with-zlib=<value>path</value></literal>&mdash;sets
the path to the sources of the zlib library.
The library distribution (version
1.1.3&mdash;1.2.8) needs to be downloaded from the
<link url="http://zlib.net">zlib</link> site and extracted.
The rest is done by nginx’s <command>./configure</command> and
<command>make</command>.
The library is required for the
<link doc="http/ngx_http_gzip_module.xml">ngx_http_gzip_module</link> module.
</para>
</listitem>

<listitem>
<para>
<literal>--with-cc-opt=<value>parameters</value></literal>&mdash;sets
additional parameters that will be added to the CFLAGS variable.
When using the system PCRE library under FreeBSD,
<literal>--with-cc-opt="-I /usr/local/include"</literal>
should be specified.
If the number of files supported by <c-func>select</c-func> needs to be
increased it can also be specified here such as this:
<literal>--with-cc-opt="-D FD_SETSIZE=2048"</literal>.
</para>
</listitem>

<listitem>
<para>
<literal>--with-ld-opt=<value>parameters</value></literal>&mdash;sets
additional parameters that will be used during linking.
When using the system PCRE library under FreeBSD,
<literal>--with-ld-opt="-L /usr/local/lib"</literal>
should be specified.
</para>
</listitem>

</list>

</para>

<para>
Example of parameters usage (all of this needs to be typed in one line):
<programlisting>
./configure
    --sbin-path=/usr/local/nginx/nginx
    --conf-path=/usr/local/nginx/nginx.conf
    --pid-path=/usr/local/nginx/nginx.pid
    --with-http_ssl_module
    --with-pcre=../pcre-8.39
    --with-zlib=../zlib-1.2.8
</programlisting>
</para>

<para>
After configuration,
nginx is compiled and installed using <command>make</command>.
</para>

</section>

</article>