Nginx compilation and Installation

Source: Internet
Author: User
Tags imap sha1 automake

1. Install the corresponding compilation tool before installing nginx
Yum-y install GCC gcc-C ++ Autoconf automake
Yum-y install zlib-devel OpenSSL-devel PCRE-devel

Create an nginx Group
Groupadd-r nginx
Useradd-S/sbin/nologin-G nginx-r nginx
Id nginx

Zlib: nginx provides the gzip module, which must be supported by the zlib library.
OpenSSL: nginx provides SSL Functions
PCRE: supports address rewrite.

2. Tar-zxvf nginx-1.2.8.tar.gz

C. CD nginx-1.2.8

Iv../configure \
-- Prefix =/usr \
-- Sbin-Path =/usr/sbin/nginx \
-- Conf-Path =/etc/nginx. conf \
-- Error-log-Path =/var/log/nginx/error. log \
-- PID-Path =/var/run/nginx. PID \
-- User = nginx \
-- Group = nginx \
With-http_ssl_module \
With-http_flv_module \
With-http_gzip_static_module \
-- Http-log-Path =/var/log/nginx/access. log \
-- Http-client-body-temp-Path =/var/tmp/nginx/client \
-- Http-proxy-temp-Path =/var/tmp/nginx/Proxy \
-- Http-FastCGI-temp-Path =/var/tmp/nginx/fcgi \
With-http_stub_status_module

V. Make & make install


Conclusion: The make compiler is not installed in centos.
Solution: Yum-y install GCC automake Autoconf libtool make


/Usr/sbin/nginx start

/Usr/sbin/nginx-S Stop | reload | stop



-Prefix = point to the installation directory

-Sbin-path points to (execute) The program file (nginx)

-Conf-Path = point to the configuration file (nginx. conf)

-Error-log-Path = pointing to the error log directory

-PID-Path = point to the PID file (nginx. PID)

-Lock-Path = point to the lock file (nginx. Lock) (the installation file is locked to prevent the installation file from being used by others or by mistake .)

-User = specifies the non-privileged user when the program is running

-Group = specifies the non-authorized user group when the program is running

-Builddir = points to the compilation directory

-With-rtsig_module enables rtsig module support (real-time signal)

-With-select_module enables select module support (polling mode, not recommended in High-load environments) Disable:-without-select_module

-With-poll_module enables poll module support (same functionality as select, same as select features, for a round-robin mode, not recommended in High-load environments)

-With-file-AIO enables file AIO support (an APL File Transfer format)

-With-ipv6 enables IPv6 support

-The with-http_ssl_module enables support for ngx_http_ssl_module (to support HTTPS requests, OpenSSL must be installed)

-The with-http_realip_module enables ngx_http_realip_module support (this module allows you to change the Client IP address value from the request header, which is off by default)

-The with-http_addition_module enables support for ngx_http_addition_module (as an output filter, supports incomplete buffering and partial response requests)

-The with-http_xslt_module enables support for ngx_http_effect_module (to filter XML requests for conversion)

-The with-http_image_filter_module enables ngx_http_image_filter_module support (transfer a filter for JPEG/GIF/PNG images) (disabled by default. GD library)

-With-http_geoip_module enables ngx_http_geoip_module support (this module creates the ngx_http_geoip_module Variable Based on the Client IP address that matches the maxmind geoip binary file)

-The with-http_sub_module enables ngx_http_sub_module support (allows some text in the nginx response to be replaced with some other text)

-The with-http_dav_module enables support for ngx_http_dav_module (Added put, delete, mkcol: Create collection, copy and move methods) by default is disabled, need to compile Enabled

-With-http_flv_module enables support for ngx_http_flv_module (provides time-based offset files for memory usage)

-With-http_gzip_static_module enables support for ngx_http_gzip_static_module (online real-time compression of output data streams)

-With-http_random_index_module enables support for ngx_http_random_index_module (randomly pick a Directory Index from the directory)

-With-http_secure_link_module enables support for ngx_http_secure_link_module (security link URL required for computing and checking requirements)

-The with-http_degradation_module enables support for ngx_http_degradation_module (204 or 444 code can be returned if there is not enough memory)

-The with-http_stub_status_module enables support for ngx_http_stub_status_module (gets the working status of nginx since the last startup)

-Without-http_charset_module disables support for ngx_http_charset_module (recode web pages, but only one direction-server-to-client, and only one byte of encoding can be reencoded)

-The without-http_gzip_module disables support for the ngx_http_gzip_module (which is the same as the-with-http_gzip_static_module function)

-Without-http_ssi_module disables support for ngx_http_ssi_module (this module provides a filter for processing server inclusion file (SSI) at the input end, and the list of currently supported SSI commands is incomplete)

-Without-http_userid_module disables support for ngx_http_userid_module (this module is used to process cookies used to determine subsequent client requests)

-The without-http_access_module disables support for the ngx_http_access_module (which provides a simple Host-Based Access Control. Allow/Deny IP addresses)

-The without-http_auth_basic_module disables the ngx_http_auth_basic_module (this module can protect your site or part of its content using the user name and password Based on the HTTP basic authentication method)

-The without-http_autoindex_module disables disable ngx_http_autoindex_module support (this module is used to automatically generate a directory list and send a request only when the ngx_http_index_module module does not find the index file .)

-Without-http_geo_module disables ngx_http_geo_module support (create some variables whose values depend on the client's IP address)

-Without-http_map_module disable ngx_http_map_module support (use any key/value pair to set configuration variables)

-The without-http_split_clients_module disables support for the ngx_http_split_clients_module, which is used to divide users based on certain conditions. Condition: IP address, header, cookies, etc)

-The without-http_referer_module disables disable ngx_http_referer_module support (this module is used to filter requests and reject requests with incorrect Referer values in the header)

-The without-http_rewrite_module disables support for the ngx_http_rewrite_module (which allows you to change the URI using a regular expression, and redirects and selects the configuration based on the variable. If this option is set at the server level, it will take effect before location. If there are further Rewrite Rules in location, the location rules will still be executed. If this URI is overwritten because of the location rule, the location part will be executed again as the new Uri. This loop will be executed 10 times, and then nginx will return a 500 error .)

-The without-http_proxy_module disables support for ngx_http_proxy_module (for proxy servers)

-Without-http_fastcgi_module disables support for ngx_http_fastcgi_module (this module allows nginx to interact with FastCGI processes and controls FastCGI process work by passing parameters. ) FastCGI is a resident public gateway interface.

-Without-http_uwsgi_module disables support for ngx_http_uwsgi_module (this module is used for uwsgi protocol, uwsgi server-related)

-The without-http_scgi_module disables ngx_http_scgi_module support (this module is used to enable scgi protocol support, which is an alternative to CGI protocol. It is an application and HTTP service interface standard. It is somewhat like FastCGI, but its design is easier to implement .)

-Without-http_memcached_module disables support for ngx_http_memcached_module (this module is used to provide simple caching to improve system efficiency)

-Without-http_limit_zone_module disables support for ngx_http_limit_zone_module (this module can control the number of concurrent connections of sessions based on conditions)

-Without-http_limit_req_module disables support for ngx_http_limit_req_module (this module allows you to limit the number of requests for an address with a given session or a specific event)

-The without-http_empty_gif_module disables support for ngx_http_empty_gif_module (this module resident in the memory of a 1*1 transparent GIF image, can be very quickly called)

-Without-http_browser_module disables ngx_http_browser_module support (this module is used to create values dependent on the request header. If the browser is modern, $ modern_browser is equal to the value allocated by the modern_browser_value command. If the browser is old, $ initent_browser is equal to the value allocated by the initent_browser_value command. If the browser is any version of MSIE, then $ MSIE equals 1)

-Without-http_upstream_ip_hash_module disables support for ngx_http_upstream_ip_hash_module (this module is used for simple load balancing)

-With-http_perl_module enables ngx_http_perl_module support (this module enables nginx to call Perl directly or through SSI)

-With-perl_modules_path = set Perl module path

-With-perl = set the path of the Perl Library File

-Http-log-Path = set the access Log Path

-Http-client-body-temp-Path = sets the path of the temporary file requested by the HTTP client.

-Http-proxy-temp-Path = set the temporary file path of the HTTP Proxy

-Http-FastCGI-temp-Path = sets the HTTP FastCGI temporary file path

-Http-uwsgi-temp-Path = set the path of the HTTP uwsgi temporary file

-Http-scgi-temp-Path = set the HTTP scgi temporary file path

-Without-http: Disable the HTTP server function

-Without-http-Cache: Disable the HTTP cache Function

-With-mail enables POP3/IMAP4/SMTP proxy module support

-With-mail_ssl_module enables support for ngx_mail_ssl_module

-The without-mail_pop3_module disables the POP3 protocol (POP3 is the 3rd version of the Post Office Protocol, which specifies how personal computers connect to mail servers on the Internet to send and receive mail. It is the first offline protocol standard for Internet email. POP3 allows you to store emails on a server to a local host, delete or save emails on the email server according to the client operation. POP3 is a member of the TCP/IP protocol family. It is mainly used to remotely manage emails on the server using a client)

-The without-mail_imap_module disables the IMAP protocol, a mail retrieval protocol. Its main function is that the mail client can use this Protocol to obtain mail information from the mail server, download mail, and so on. The IMAP protocol runs on the TCP/IP protocol, and the port used is 143. The main difference between the POP3 protocol and POP3 protocol is that you do not need to download all emails, but can directly perform operations on emails on the server through the client .)

-The without-mail_smtp_module disables the SMTP Protocol (SMTP is the Simple Mail Transfer Protocol, which is a set of rules used to send messages from the source address to the destination address, which controls the way in which messages are transferred. The SMTP protocol belongs to the TCP/IP protocol family and helps each computer locate the next destination when sending or transferring letters .)

-With-google_perftools_module enables support for ngx_google_perftools_module (for debugging, profiling program performance bottlenecks)

-The with-cpp_test_module enables support for ngx_cpp_test_module

-Add-module = enable external module support

-With-CC = pointing to the C compiler path

-With-CPP = pointing to the C preprocessing path

-With-CC-opt = set the C compiler parameters (for the PCRE Library, you must specify-with-CC-opt = "-I/usr/local/include". If select () is used () the function needs to increase the number of file descriptors at the same time. You can use-with-CC-opt = "-D fd_setsize = 2048" to specify the number of file descriptors .)

-With-LD-opt = sets the connection file parameters. (For the PCRE Library, you must specify-with-LD-opt = "-L/usr/local/lib ".)

-With-CPU-opt = indicates the compiled CPU. The available values are Pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, and ppc64.

-Without-PCRE: Disable the PCRE Library

-With-PCRE: Enable the PCRE Library

-With-PCRE = point to the PCRE Library file directory

-With-PCRE-opt = set additional parameters for the PCRE Library during compilation

-With-md5 = pointing to the MD5 library file directory (Message Digest algorithm Fifth edition, used to provide message integrity protection)

-With-md5-opt = set additional parameters for the MD5 library during compilation

-With-md5-asm uses MD5 Assembly Source

-With-sha1 = pointing to sha1 library directory (digital signature algorithm, mainly used for digital signature)

-With-sha1-opt = set additional parameters for the sha1 library during compilation

-The with-sha1-asm uses the sha1 Assembly Source

-With-zlib = pointing to the zlib library directory

-With-zlib-opt = set additional parameters for zlib during compilation

-With-zlib-ASM = optimizes the zlib Assembly source for the specified CPU. The CPU type is Pentium and pentiumpro.

-With-libatomic provides an architecture for the implementation of atomic memory update operations

-With-libatomic = points to the libatomic_ops installation directory

-With-OpenSSL = points to the OpenSSL installation directory

-With-OpenSSL-OPT: set additional parameters for OpenSSL during compilation

-With-Debug: Enable debug logs





Nginx compilation and Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.