Current location - Quotes Website - Personality signature - How to compile ngx
How to compile ngx
First, the necessary software preparation

1. Install pcre

In order to support the rewrite function, we need to install pcre.

The copy code code is as follows:

# yum install pcre* // If it is already installed, please skip this step.

Install openssl

Ssl support is required. If ssl support is not required, please skip this step.

The copy code code is as follows:

# yum installing openssl*

3.gzip class library installation

The copy code code is as follows:

Yum installs zlib zlib-devel

Install wget

Download nginx for use. If already installed, please skip this step.

The copy code code is as follows:

# yum install wget

Second, install nginx.

1.[ meter]

The copy code code is as follows:

wget

nginx.com。

Close:

The copy code code is as follows:

/usr/local/nginx- 1 . 7 . 0/sbin/nginx-s stop

Reset: When modifying the configuration file, just reload it below.

The copy code code is as follows:

/usr/local/nginx-1.7.0/sbin/nginx-s reload.

This is the end of the entire nginx installation.

Four. Detailed explanation of nginx compilation parameters

The copy code code is as follows:

–-prefix = Point to the installation directory.

--sbin-path points to (executes) the program file (nginx)

–-conf-path = Point to the configuration file (nginx.conf).

–error-log-path = Point to the error log directory.

–-pid-path = points to the PID file (nginx.pid).

–-lock-path = point to the lock file (nginx.lock) (The installation file is locked to prevent others from using it or mishandling it. )

–-user = Specifies the unprivileged user when the program runs.

–-group = Specifies the unprivileged user group when the program runs.

–builddir = points to the compilation directory.

–Enable rtsig module support (real-time signal) with -rtsig _ module.

–Use -select _ module to enable selection module support (polling mode, not recommended in high-load environment) Disable:–Do not use -select _ module.

–-with-poll _ module enables polling module support (it has the same functions and features as select, is a polling mode, and is not recommended to be used in high-load environment).

–Enable file AIO support (an APL file transfer format) with -file-AIO.

-Enable ipv6 support with ipv6.

–-with-http _ SSL _ module enables ngx_http_ssl_module support (openssl is required to support https requests).

–-with-http _ realip _ module enables ngx_http_realip_module support (this module allows the ip address value of the client to be changed from the request header, and the default is off).

–-with-http _ addition _ module enables ngx_http_addition_module support (as an output filter, it supports incomplete buffering and responds to requests in parts).

–-with-http _ XSLT _ module enables ngx_http_xslt_module support (filtering transformation XML requests).

–-with-http _ image _ filter _ module enables ngx_http_image_filter_module support (a filter for transmitting JPEG/GIF/PNG pictures) (not enabled by default). Gd library will be used)

–-with-http _ Geoip _ module enables ngx_http_geoip_module support (this module creates ngx_http_geoip_module variable based on the client IP address that matches the MaxMind GeoIP binary file).

–-with-http _ sub _ module enables ngx_http_sub_module support (allowing some other text to replace some text in the nginx response).

–-with-http _ dav _ module enables ngx_http_dav_module support (add PUT, DELETE, MKCOL: create collection, COPY and MOVE methods), which is closed by default and needs to be compiled before opening.

–Enable ngx_http_flv_module support with -http _ flv _ module (provide time-based offset file to find memory usage).

–Enable ngx_http_gzip_static_module support (online real-time compression of output data stream) together with -http _ gzip _ static _ module.

–-with-http _ random _ index _ module enables ngx_http_random_index_module support (randomly select a directory index from the directory).

–Enable ngx_http_secure_link_module support together with -http _ secure _ link _ module (secure link URL is required when calculating and checking requirements).

–-with-http _ degradation _ module enables ngx_http_degradation_module support (allowing 204 or 444 codes to be returned in case of insufficient memory).

–-with-http _ stub _ status _ module enables ngx_http_stub_status_module support (to get the working status of nginx since it was last started).

–Without -http _ charset _ module, ngx_http_charset_module support will be disabled (web pages will be recoded in one direction only–from server to client, and only one byte of encoding can be recoded).

–Without -http _ gzip _ module, ngx_http_gzip_module support will be disabled (this module has the same function as -with-http_gzip_static_module).

–Disable ngx_http_ssi_module support without -http _ ssi _ module (this module provides a filter for processing server inclusion files (SSI) at the input, and the list of currently supported SSI commands is incomplete).

–Not using -http _ userid _ module will disable ngx_http_userid_module support (this module is used to process cookies used to determine subsequent requests of clients).

–Not using -http _ access _ module will disable ngx_http_access_module support (this module provides simple host-based access control. Allow/deny based on ip address)

–Disable ngx_http_auth_basic_module without -http _ auth _ basic _ module (this module can protect your site or part of it by using basic authentication method based on HTTP).

–without -http _ autoindex _ module disable disable NGX _ http _ autoindex _ module support (this module is used to automatically generate the directory list and only make a request when ngx_http_index_module cannot find the index file. )

–Without -http _ geo _ module, ngx_http_geo_module support will be disabled (create some variables whose values depend on the IP address of the client).

–Without -http _ map _ module, ngx_http_map_module support is disabled (any key/value pair is used to set configuration variables).

–Without -http _ split _ clients _ module, ngx_http_split_clients_module support will be disabled (this module is used to divide users according to certain conditions. Ip address, header, cookies and other conditions. )

–If -http _ Referer _ module is not used, the support of ngx_http_Referer_module will be disabled (this module is used to filter requests and reject those with incorrect referer value in the header).

–Disable ngx_http_rewrite_module support without -http _ rewrite _ module (This module allows you to change URIs using regular expressions and change and select the configuration according to variables. If the options are set at the server level, they will take effect before positioning. If there are further rewriting rules in location, some rules in location will still be implemented. If this URI rewriting is caused by the rules of the location part, then the location part will be executed again as a new URI. This loop will be executed 10 times, and then Nginx will return a 500 error. )

–Not using -http _ proxy _ module will disable ngx_http_proxy_module support (for proxy servers).

–Disable ngx_http_FastCGI_module support without -http _ FastCGI _ module (this module allows Nginx to interact with FastCGI process and control the work of FastCGI process by passing parameters. FastCGI is a resident public gateway interface.

–without -http _ uWSGI _ module, disable ngx_http_uWSGI_module support (this module is used for medical uwsgi protocol and related to uwsgi server).

–Disable ngx _ http _ SCGI _ module support without -http _ SCGI _ module (this module is used to enable SCGI protocol support, which is an alternative to CGI protocol. It is an interface standard between applications and HTTP services. It's a bit like FastCGI, but its design is easier to implement. )

–Disable ngx_http_memcached_module support without -http _ memcached _ module (this module is used to provide simple caching to improve system efficiency).

-without-http _ limit _ zone _ module disables ngx_http_limit_zone_module support (this module can control the number of concurrent connections of a session according to conditions).

–Not using -http _ limit _ req _ module disables ngx_http_limit_req_module support (this module allows you to limit the number of address requests for a given session or a specific event).

–Disable ngx_http_empty_GIF_module support without -http _ empty _ GIF _ module (the module has a transparent gif image of 1* 1 in memory, which is very fast to call).

–Disable ngx_http_browser_module support without -http _ browser _ module (this module is used to create values that depend on the request header. If the browser is modern, $modern_browser is equal to the value assigned by the modern_browser_value instruction; If the browser is old, $ancient_browser is equal to the value given by the ancient_browser_value instruction; If the browser is any version in MSIE, $msie is equal to 1).

–Not using -http _ upstream _ IP _ hash _ module will disable NGX _ http _ upstream _ IP _ hash _ module support (this module is used for simple load balancing).

–-with-http _ Perl _ module enables ngx_http_perl_module support (this module enables nginx to use Perl directly or call Perl through ssi).

–with-perl _ modules _ path = Set-with-perl _ modules _ path =。

–-with-Perl = Set the Perl library file path.

–http-log-path = Set the access log path.

–HTTP-client-body-temp-path = Set the path for HTTP clients to request temporary files.

–http-proxy-temp-path = setting -http-proxy-temp-path = file path.

–http-fastcgi-temp-path = setting -http-fastcgi-temp-path = file path.

–http-uwsgi-temp-path = setting -http-uw SGI-temp-path = file path.

–http-scgi-temp-path = setting -http-scgi-temp-path = file path.

-without-http disables the http server function.

–without -http-cache Disable-without -http-cache function.

––– Enable POP3/IMAP4/SMTP proxy module support by email.

–-with-mail _ SSL _ module enables ngx_mail_ssl_module support.

–-without-mail _ pop 3 _ module disables the POP3 protocol (POP3 is the third version of post office protocol, which is a protocol that specifies how a personal computer connects to a mail server on the Internet to send and receive mail. It is the first offline protocol standard for Internet e-mail. POP3 protocol allows users to store mail from the server to the local host, and at the same time delete or save the mail on the mail server according to the operation of the client. POP3 protocol is a member of TCP/IP protocol family, which is mainly used to support the remote management of e-mail on the server using the client.

–Without -mail _ imap _ module, imap protocol (a mail acquisition protocol) will be disabled. Its main function is that the mail client can obtain the information of the mail from the mail server and download the mail through this protocol. IMAP protocol runs on top of TCP/IP protocol, and the port used is 143. The main difference between it and POP3 protocol is that users can directly operate the mail on the server through the client without downloading all the mail. )

–-without-mail _ smtp _ module disables SMTP protocol (SMTP is a simple mail transmission protocol, which is a set of rules for sending mail from source address to destination address, and it controls the transmission mode of letters. SMTP protocol belongs to TCP/IP protocol family, which helps each computer find the next destination when sending or transmitting letters. )

–use -Google _ perftools _ module to enable ngx_google_perftools_module support (for debugging and analyzing program performance bottlenecks).

–Enable ngx_cpp_test_module support with -CPP _ test _ module.

–-add-module = Enable external module support.

–with-cc = the path of the c compiler.

–-with-CPP = points to the C preprocessing path.

–with-cc-opt = set c compiler parameters (PCRE library, you need to specify–with-cc-opt = "-i/usr/local/include". If you use the select () function, you need to increase the number of file descriptors at the same time, you can use–with-cc-opt = "-dfd _ setsize = 2048. )

–Use -ld-opt = to set the connection file parameters. (PCRE library, you need to specify–with-ld-opt = "-l/usr/local/lib". )

–with-CPU-opt = specifies the compiled CPU. Available values are: Pentium, Pentium Pro, Pentium 3, Pentium 4, Athlon, Opteron, Amd64, SPARC 32, SPARC 64, PPC64.

-Not using pcre will disable the pcre library.

-Enable the pcre library together with pcre.

–-with-pcre = points to the directory of the pcre library file.

–with-pcre-opt = Set additional parameters for the pcre library at compile time.

–-with-md5 = points to the MD5 library file directory (message digest algorithm version 5, which provides message integrity protection).

–with-MD5-opt = Set additional parameters for the MD5 library at compile time.

–with-MD5-ASM uses the MD5 assembly source.

–with-sha 1 = points to sha1library directory (digital signature algorithm, mainly used for digital signature).

–with-sha 1-opt = Set additional parameters for sha1library at compile time.

–use -sha 1-ASM to compile the source using sha 1.

–-with-zlib = points to the zlib library directory.

–with-zlib-opt = Set additional parameters for zlib at compile time.

–with-zlib-ASM = Optimize the specified CPU using zlib assembly source code, and the CPU type is pentium and pentiumpro.

--with-libatomic provides a framework for the implementation of atomic memory update operation.

–-with-libatomic = points to the installation directory of libatomic_ops.

–-with-openssl = points to the OpenSSL installation directory.

–with-OpenSSL-opt sets additional parameters for OpenSSL at compile time.

--with-debug enables debugging logging.