Building nginx from Sources (original) (raw)
The build is configured using the configure
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 Makefile
.
The configure
command supports the following parameters:
--help
prints a help message.
--prefix=`_path_`
defines a directory that will keep server files. This same directory will also be used for all relative paths set byconfigure
(except for paths to libraries sources) and in the nginx.conf
configuration file. It is set to the /usr/local/nginx
directory by default.
--sbin-path=`_path_`
sets the name of an nginx executable file. This name is used only during installation. By default the file is named`_prefix_`/sbin/nginx
.
--modules-path=`_path_`
defines a directory where nginx dynamic modules will be installed. By default the `_prefix_`/modules
directory is used.
--conf-path=`_path_`
sets the name of an nginx.conf
configuration file. If needs be, nginx can always be started with a different configuration file, by specifying it in the command-line parameter-c `_file_`
. By default the file is named`_prefix_`/conf/nginx.conf
.
--error-log-path=`_path_`
sets the name of the primary error, warnings, and diagnostic file. After installation, the file name can always be changed in thenginx.conf
configuration file using theerror_log directive. By default the file is named`_prefix_`/logs/error.log
.
--pid-path=`_path_`
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 thenginx.conf
configuration file using thepid directive. By default the file is named`_prefix_`/logs/nginx.pid
.
--lock-path=`_path_`
sets a prefix for the names of lock files. After installation, the value can always be changed in thenginx.conf
configuration file using thelock_file directive. By default the value is`_prefix_`/logs/nginx.lock
.
--user=`_name_`
sets the name of an unprivileged user whose credentials will be used by worker processes. After installation, the name can always be changed in thenginx.conf
configuration file using theuser directive. The default user name is nobody.
--group=`_name_`
sets the name of a group whose credentials will be used by worker processes. After installation, the name can always be changed in thenginx.conf
configuration file using theuser directive. By default, a group name is set to the name of an unprivileged user.
--build=`_name_`
sets an optional nginx build name.
--builddir=`_path_`
sets a build directory.
--with-select_module
--without-select_module
enables or disables building a module that allows the server to work with the select()
method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, or /dev/poll.
--with-poll_module
--without-poll_module
enables or disables building a module that allows the server to work with the poll()
method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, or /dev/poll.
--with-threads
enables the use ofthread pools.
--with-file-aio
enables the use ofasynchronous file I/O(AIO) on FreeBSD and Linux.
--with-http_ssl_module
enables building a module that adds theHTTPS protocol supportto an HTTP server. This module is not built by default. The OpenSSL library is required to build and run this module.
--with-http_v2_module
enables building a module that provides support forHTTP/2. This module is not built by default.
--with-http_v3_module
enables building a module that provides support forHTTP/3. This module is not built by default. An SSL library that provides HTTP/3 support is recommended to build and run this module, such asBoringSSL,LibreSSL, orQuicTLS. Otherwise, if using the OpenSSL library, OpenSSL compatibility layer will be used that does not support QUICearly data.
--with-http_realip_module
enables building thengx_http_realip_modulemodule that changes the client address to the address sent in the specified header field. This module is not built by default.
--with-http_addition_module
enables building thengx_http_addition_modulemodule that adds text before and after a response. This module is not built by default.
--with-http_xslt_module
--with-http_xslt_module=dynamic
enables building thengx_http_xslt_modulemodule that transforms XML responses using one or more XSLT stylesheets. This module is not built by default. The libxml2 andlibxslt libraries are required to build and run this module.
--with-http_image_filter_module
--with-http_image_filter_module=dynamic
enables building thengx_http_image_filter_modulemodule that transforms images in JPEG, GIF, PNG, and WebP formats. This module is not built by default.
--with-http_geoip_module
--with-http_geoip_module=dynamic
enables building thengx_http_geoip_modulemodule that creates variables depending on the client IP address and the precompiledMaxMind databases. This module is not built by default.
--with-http_sub_module
enables building thengx_http_sub_modulemodule that modifies a response by replacing one specified string by another. This module is not built by default.
--with-http_dav_module
enables building thengx_http_dav_modulemodule that provides file management automation via the WebDAV protocol. This module is not built by default.
--with-http_flv_module
enables building thengx_http_flv_modulemodule that provides pseudo-streaming server-side support for Flash Video (FLV) files. This module is not built by default.
--with-http_mp4_module
enables building thengx_http_mp4_modulemodule that provides pseudo-streaming server-side support for MP4 files. This module is not built by default.
--with-http_gunzip_module
enables building thengx_http_gunzip_modulemodule that decompresses responses with “Content-Encoding: gzip
” for clients that do not support “gzip” encoding method. This module is not built by default.
--with-http_gzip_static_module
enables building thengx_http_gzip_static_modulemodule that enables sending precompressed files with the “.gz
” filename extension instead of regular files. This module is not built by default.
--with-http_auth_request_module
enables building thengx_http_auth_request_modulemodule that implements client authorization based on the result of a subrequest. This module is not built by default.
--with-http_random_index_module
enables building thengx_http_random_index_modulemodule that processes requests ending with the slash character (‘/
’) and picks a random file in a directory to serve as an index file. This module is not built by default.
--with-http_secure_link_module
enables building thengx_http_secure_link_modulemodule. This module is not built by default.
--with-http_degradation_module
enables building thengx_http_degradation_module
module. This module is not built by default.
--with-http_slice_module
enables building thengx_http_slice_modulemodule that splits a request into subrequests, each returning a certain range of response. The module provides more effective caching of big responses. This module is not built by default.
--with-http_stub_status_module
enables building thengx_http_stub_status_modulemodule that provides access to basic status information. This module is not built by default.
--without-http_charset_module
disables building thengx_http_charset_modulemodule that adds the specified charset to the “Content-Type” response header field and can additionally convert data from one charset to another.
--without-http_gzip_module
disables building a module that compresses responsesof an HTTP server. The zlib library is required to build and run this module.
--without-http_ssi_module
disables building thengx_http_ssi_modulemodule that processes SSI (Server Side Includes) commands in responses passing through it.
--without-http_userid_module
disables building thengx_http_userid_modulemodule that sets cookies suitable for client identification.
--without-http_access_module
disables building thengx_http_access_modulemodule that allows limiting access to certain client addresses.
--without-http_auth_basic_module
disables building thengx_http_auth_basic_modulemodule that allows limiting access to resources by validating the user name and password using the “HTTP Basic Authentication” protocol.
--without-http_mirror_module
disables building thengx_http_mirror_modulemodule that implements mirroring of an original request by creating background mirror subrequests.
--without-http_autoindex_module
disables building thengx_http_autoindex_modulemodule that processes requests ending with the slash character (‘/
’) and produces a directory listing in case thengx_http_index_module module cannot find an index file.
--without-http_geo_module
disables building thengx_http_geo_modulemodule that creates variables with values depending on the client IP address.
--without-http_map_module
disables building thengx_http_map_modulemodule that creates variables with values depending on values of other variables.
--without-http_split_clients_module
disables building thengx_http_split_clients_modulemodule that creates variables for A/B testing.
--without-http_referer_module
disables building thengx_http_referer_modulemodule that can block access to a site for requests with invalid values in the “Referer” header field.
--without-http_rewrite_module
disables building a module that allows an HTTP server toredirect requests and change URI of requests. The PCRE library is required to build and run this module.
--without-http_proxy_module
disables building an HTTP serverproxying module.
--without-http_fastcgi_module
disables building thengx_http_fastcgi_modulemodule that passes requests to a FastCGI server.
--without-http_uwsgi_module
disables building thengx_http_uwsgi_modulemodule that passes requests to a uwsgi server.
--without-http_scgi_module
disables building thengx_http_scgi_modulemodule that passes requests to an SCGI server.
--without-http_grpc_module
disables building thengx_http_grpc_modulemodule that passes requests to a gRPC server.
--without-http_memcached_module
disables building thengx_http_memcached_modulemodule that obtains responses from a memcached server.
--without-http_limit_conn_module
disables building thengx_http_limit_conn_modulemodule that limits the number of connections per key, for example, the number of connections from a single IP address.
--without-http_limit_req_module
disables building thengx_http_limit_req_modulemodule that limits the request processing rate per key, for example, the processing rate of requests coming from a single IP address.
--without-http_empty_gif_module
disables building a module thatemits single-pixel transparent GIF.
--without-http_browser_module
disables building thengx_http_browser_modulemodule that creates variables whose values depend on the value of the “User-Agent” request header field.
--without-http_upstream_hash_module
disables building a module that implements thehashload balancing method.
--without-http_upstream_ip_hash_module
disables building a module that implements theip_hashload balancing method.
--without-http_upstream_least_conn_module
disables building a module that implements theleast_connload balancing method.
--without-http_upstream_random_module
disables building a module that implements therandomload balancing method.
--without-http_upstream_keepalive_module
disables building a module that providescaching of connections to upstream servers.
--without-http_upstream_zone_module
disables building a module that makes it possible to store run-time state of an upstream group in a shared memoryzone.
--with-http_perl_module
--with-http_perl_module=dynamic
enables building theembedded Perl module. This module is not built by default.
--with-perl_modules_path=`_path_`
defines a directory that will keep Perl modules.
--with-perl=`_path_`
sets the name of the Perl binary.
--http-log-path=`_path_`
sets the name of the primary request log file of the HTTP server. After installation, the file name can always be changed in thenginx.conf
configuration file using theaccess_log directive. By default the file is named`_prefix_`/logs/access.log
.
--http-client-body-temp-path=`_path_`
defines a directory for storing temporary files that hold client request bodies. After installation, the directory can always be changed in thenginx.conf
configuration file using theclient_body_temp_pathdirective. By default the directory is named`_prefix_`/client_body_temp
.
--http-proxy-temp-path=`_path_`
defines a directory for storing temporary files with data received from proxied servers. After installation, the directory can always be changed in thenginx.conf
configuration file using theproxy_temp_pathdirective. By default the directory is named`_prefix_`/proxy_temp
.
--http-fastcgi-temp-path=`_path_`
defines a directory for storing temporary files with data received from FastCGI servers. After installation, the directory can always be changed in thenginx.conf
configuration file using thefastcgi_temp_pathdirective. By default the directory is named`_prefix_`/fastcgi_temp
.
--http-uwsgi-temp-path=`_path_`
defines a directory for storing temporary files with data received from uwsgi servers. After installation, the directory can always be changed in thenginx.conf
configuration file using theuwsgi_temp_pathdirective. By default the directory is named`_prefix_`/uwsgi_temp
.
--http-scgi-temp-path=`_path_`
defines a directory for storing temporary files with data received from SCGI servers. After installation, the directory can always be changed in thenginx.conf
configuration file using thescgi_temp_pathdirective. By default the directory is named`_prefix_`/scgi_temp
.
--without-http
disables the HTTP server.
--without-http-cache
disables HTTP cache.
--with-mail
--with-mail=dynamic
enables POP3/IMAP4/SMTPmail proxy server.
--with-mail_ssl_module
enables building a module that adds theSSL/TLS protocol supportto the mail proxy server. This module is not built by default. The OpenSSL library is required to build and run this module.
--without-mail_pop3_module
disables the POP3 protocol in mail proxy server.
--without-mail_imap_module
disables the IMAP protocol in mail proxy server.
--without-mail_smtp_module
disables the SMTP protocol in mail proxy server.
--with-stream
--with-stream=dynamic
enables building thestream modulefor generic TCP/UDP proxying and load balancing. This module is not built by default.
--with-stream_ssl_module
enables building a module that adds theSSL/TLS protocol supportto the stream module. This module is not built by default. The OpenSSL library is required to build and run this module.
--with-stream_realip_module
enables building thengx_stream_realip_modulemodule that changes the client address to the address sent in the PROXY protocol header. This module is not built by default.
--with-stream_geoip_module
--with-stream_geoip_module=dynamic
enables building thengx_stream_geoip_modulemodule that creates variables depending on the client IP address and the precompiledMaxMind databases. This module is not built by default.
--with-stream_ssl_preread_module
enables building thengx_stream_ssl_preread_modulemodule that allows extracting information from theClientHellomessage without terminating SSL/TLS. This module is not built by default.
--without-stream_limit_conn_module
disables building thengx_stream_limit_conn_modulemodule that limits the number of connections per key, for example, the number of connections from a single IP address.
--without-stream_access_module
disables building thengx_stream_access_modulemodule that allows limiting access to certain client addresses.
--without-stream_geo_module
disables building thengx_stream_geo_modulemodule that creates variables with values depending on the client IP address.
--without-stream_map_module
disables building thengx_stream_map_modulemodule that creates variables with values depending on values of other variables.
--without-stream_split_clients_module
disables building thengx_stream_split_clients_modulemodule that creates variables for A/B testing.
--without-stream_return_module
disables building thengx_stream_return_modulemodule that sends some specified value to the client and then closes the connection.
--without-stream_set_module
disables building thengx_stream_set_modulemodule that sets a value for a variable.
--without-stream_upstream_hash_module
disables building a module that implements thehashload balancing method.
--without-stream_upstream_least_conn_module
disables building a module that implements theleast_connload balancing method.
--without-stream_upstream_random_module
disables building a module that implements therandomload balancing method.
--without-stream_upstream_zone_module
disables building a module that makes it possible to store run-time state of an upstream group in a shared memoryzone.
--with-google_perftools_module
enables building thengx_google_perftools_modulemodule that enables profiling of nginx worker processes usingGoogle Performance Tools. The module is intended for nginx developers and is not built by default.
--with-cpp_test_module
enables building thengx_cpp_test_module
module.
--add-module=`_path_`
enables an external module.
--add-dynamic-module=`_path_`
enables an external dynamic module.
--with-compat
enables dynamic modules compatibility.
--with-cc=`_path_`
sets the name of the C compiler.
--with-cpp=`_path_`
sets the name of the C preprocessor.
--with-cc-opt=`_parameters_`
sets additional parameters that will be added to the CFLAGS variable. When using the system PCRE library under FreeBSD,--with-cc-opt="-I /usr/local/include"
should be specified. If the number of files supported by select()
needs to be increased it can also be specified here such as this:--with-cc-opt="-D FD_SETSIZE=2048"
.
--with-ld-opt=`_parameters_`
sets additional parameters that will be used during linking. When using the system PCRE library under FreeBSD,--with-ld-opt="-L /usr/local/lib"
should be specified.
--with-cpu-opt=`_cpu_`
enables building per specified CPU:pentium
, pentiumpro
,pentium3
, pentium4
,athlon
, opteron
,sparc32
, sparc64
,ppc64
.
--without-pcre
disables the usage of the PCRE library.
--with-pcre
forces the usage of the PCRE library.
--with-pcre=`_path_`
sets the path to the sources of the PCRE library. The library distribution needs to be downloaded from thePCRE site and extracted. The rest is done by nginx’s ./configure
andmake
. The library is required for regular expressions support in thelocation directive and for thengx_http_rewrite_modulemodule.
--with-pcre-opt=`_parameters_`
sets additional build options for PCRE.
--with-pcre-jit
builds the PCRE library with “just-in-time compilation” support (1.1.12, thepcre_jit directive).
--without-pcre2
disables use of the PCRE2 library instead of the original PCRE library (1.21.5).
--with-zlib=`_path_`
sets the path to the sources of the zlib library. The library distribution needs to be downloaded from thezlib site and extracted. The rest is done by nginx’s ./configure
andmake
. The library is required for thengx_http_gzip_module module.
--with-zlib-opt=`_parameters_`
sets additional build options for zlib.
--with-zlib-asm=`_cpu_`
enables the use of the zlib assembler sources optimized for one of the specified CPUs:pentium
, pentiumpro
.
--with-libatomic
forces the libatomic_ops library usage.
--with-libatomic=`_path_`
sets the path to the libatomic_ops library sources.
--with-openssl=`_path_`
sets the path to the OpenSSL library sources.
--with-openssl-opt=`_parameters_`
sets additional build options for OpenSSL.
--with-debug
enables the debugging log.
Example of parameters usage (all of this needs to be typed in one line):
./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=../pcre2-10.39 --with-zlib=../zlib-1.3
After configuration, nginx is compiled and installed using make
.