Mercurial > hg > nginx-site
view xml/en/docs/configure.xml @ 924:a2aea48ff155
New "installation" article.
Old "installation" was renamed to "configure" and describes how
to build nginx from sources.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 31 May 2013 13:05:51 +0400 |
parents | xml/en/docs/install.xml@65e75e59a714 |
children | eea7541e7c6a |
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="4"> <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>—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>—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>—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>—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>—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>—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>—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>—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>—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, rtsig, or /dev/poll. </para> </listitem> <listitem> <para> <literal>--with-poll_module</literal><br/> <literal>--without-poll_module</literal>—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, rtsig, or /dev/poll. </para> </listitem> <listitem> <para> <literal>--without-http_gzip_module</literal>—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>—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>—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>—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>—sets the path to the sources of the PCRE library. The library distribution (version 4.4—8.32) 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>—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>—sets the path to the sources of the zlib library. The library distribution (version 1.1.3—1.2.7) 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>—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>—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-4.4 --with-zlib=../zlib-1.1.3 </programlisting> </para> <para> After configuration, nginx is compiled and installed using <command>make</command>. </para> </section> </article>