This article mainly introduces the Linux under the installation of Nginx compiler tutorial and compilation parameters, the need for friends can refer to the following
First, the necessary software preparation
1. Installing Pcre
In order to support the rewrite feature, we need to install Pcre
Copy the code code as follows:
# yum Install pcre*//If you have already installed, please skip this step
2. Installing OpenSSL
Requires SSL support, skip this step if SSL support is not required
Copy the code code as follows:
# yum Install openssl*
3.gzip Class Library Installation
Copy the code code as follows:
Yum Install zlib Zlib-devel
4. Installing wget
Download Nginx use, if already installed, skip this step
Copy the code code as follows:
# www.qixoo.qixoo.com Yum Install wget
Second, install Nginx
1. Download
Copy the code code as follows:
wget http://nginx.org/download/nginx-1.7.0.tar.gz
2. Unzip
Copy the code code as follows:
TAR-ZXVF nginx-1.7.0.tar.gz
3. Compiling and installing
Execute the following command:
Copy the code code as follows:
# CD nginx-1.7.0
#./configure--prefix=/usr/local/nginx-1.7.0 \
--with-http_ssl_module--with-http_spdy_module \
--with-http_stub_status_module--with-pcre
–with-http_stub_status_module: Support nginx status Query
–with-http_ssl_module: Support HTTPS
–with-http_spdy_module: Support Google's spdy, want to know please Baidu Spdy, this must have SSL support
–with-pcre: In order to support the rewrite rewrite function, it is necessary to develop pcre
The final output is as follows, indicating configure OK.
Copy the code code as follows:
Checking for zlib library ... found
Creating Objs/makefile
Configuration Summary
+ Using System PCRE Library
+ Using System OpenSSL Library
+ md5:using OpenSSL Library
+ sha1:using OpenSSL Library
+ Using System zlib Library
Nginx path prefix: "/usr/local/nginx-1.7.0"
Nginx binary file: "/usr/local/nginx-1.7.0/sbin/nginx"
Nginx configuration prefix: "/usr/local/nginx-1.7.0/conf"
Nginx configuration file: "/usr/local/nginx-1.7.0/conf/nginx.conf"
Nginx pid file: "/usr/local/nginx-1.7.0/logs/nginx.pid"
Nginx error log file: "/usr/local/nginx-1.7.0/logs/error.log"
Nginx HTTP access log file: "/usr/local/nginx-1.7.0/logs/access.log"
Nginx HTTP client request body Temporary files: "Client_body_temp"
Nginx HTTP proxy temporary files: "Proxy_temp"
Nginx http fastcgi temporary files: "Fastcgi_temp"
Nginx http Uwsgi temporary files: "Uwsgi_temp"
Nginx http scgi temporary files: "Scgi_temp"
# make//To make sure your server has setup, do yum install if not installed
# make Install
Three, start, close, reset Nginx
Start: Directly execute the following command, Nginx started, do not need to change any configuration files, nginx configuration multi-domain virtual host please refer to the following articles.
Copy the code code as follows:
/usr/local/nginx-1.7.0/sbin/nginx
Try access: Use the Curl command to read Web information directly
Copy the code code as follows:
[Conf]
# curl-s http://localhost | grep nginx.com
Nginx.com.
Shut down:
Copy the code code as follows:
/usr/local/nginx-1.7.0/sbin/nginx-s stop
Reset: When you have to modify the configuration file, you only need to reload the following
Copy the code code as follows:
/usr/local/nginx-1.7.0/sbin/nginx-s Reload
The entire Nginx installation is here to end.
Iv. detailed specification of Nginx compiler parameters
Copy the code code as follows:
–prefix= pointing to the installation directory
–sbin-path Point (Execute) program file (Nginx)
–conf-path= pointing to the configuration file (nginx.conf)
–error-log-path= pointing to the error log directory
–pid-path= pointing to the PID file (nginx.pid)
–lock-path= points to the lock file (nginx.lock) (Install file lock, prevent the installation file from being exploited by others, or operate it by mistake.) )
–user= specifies a non-privileged user when the program is run
–group= to specify a non-privileged user group when the program is run
–builddir= pointing to the compilation directory
–with-rtsig_module Enable Rtsig module support (real-time signal)
–with-select_module Enable Select module Support (a polling mode that is not recommended for use in high-load environments) Disable: –without-select_module
–with-poll_module Enable poll module support (features same as SELECT, same as Select feature, as a polling mode, not recommended for high-load environments)
–with-file-aio Enable file Aio support (an APL file transfer format)
–with-ipv6 Enable IPv6 support
–with-http_ssl_module Enable Ngx_http_ssl_module support (to enable HTTPS requests, you need to have OpenSSL installed)
–with-http_realip_module Enable Ngx_http_realip_module Support (this module allows changing the client's IP address value from the request header, which is off by default)
–with-http_addition_module Enable Ngx_http_addition_module support (as an output filter that supports incomplete buffering, partial response requests)
–with-http_xslt_module Enable Ngx_http_xslt_module support (Filter transform XML request)
–with-http_image_filter_module Enable Ngx_http_image_filter_module Support (a filter that transmits jpeg/gif/png pictures) (the default is not enabled.) GD Library to use)
–with-http_geoip_module Enable Ngx_http_geoip_module Support (This module creates a Ngx_http_geoip_module variable based on the client IP address that matches the Maxmind GeoIP binary file)
–with-http_sub_module Enable Ngx_http_sub_module support (allow some other text to replace some of the text in the Nginx response)
–with-http_dav_module Enable Ngx_http_dav_module Support (add Put,delete,mkcol: Create collection, copy and Move methods) is off by default and needs to be compiled to open
–with-http_flv_module Enable Ngx_http_flv_module Support (provides time-based offset files seeking memory usage)
–with-http_gzip_static_module Enable Ngx_http_gzip_static_module support (online real-time compressed output data stream)
–with-http_random_index_module Enable Ngx_http_random_index_module support (randomly pick a directory index from the directory)
–with-http_secure_link_module Enable Ngx_http_secure_link_module support (required secure link URLs for compute and check requirements)
–with-http_degradation_module Enable Ngx_http_degradation_module Support (allows 204 or 444 yards to be returned in case of low memory)
–with-http_stub_status_module Enable Ngx_http_stub_status_module support (get Nginx's working status since last boot)
–without-http_charset_module disabling Ngx_http_charset_module support (recoding Web pages, but only one Direction – server-to-client, and only one byte of encoding can be re-encoded)
–without-http_gzip_module Disabling Ngx_http_gzip_module support (the same module as the-with-http_gzip_static_module function)
–without-http_ssi_module Disable Ngx_http_ssi_module Support (This module provides a filter on the input processing server include file (SSI), currently the list of supported SSI commands is incomplete)
–without-http_userid_module Disable Ngx_http_userid_module Support (this module is used to process cookies used to determine the client's subsequent requests)
–without-http_access_module Disables Ngx_http_access_module support (this module provides a simple host-based access control.) Allow/deny based on IP address)
–without-http_auth_basic_module Disable Ngx_http_auth_basic_module (the module is able to use the user name and password based on the HTTP Basic authentication method to protect your site or some of its content)
–without-http_autoindex_module Disable Disable Ngx_http_autoindex_module support (this module is used to automatically generate a list of directories only ngx_http_index_ The module module makes a request when the index file is not found. )
–without-http_geo_module Disable Ngx_http_geo_module support (create some variables whose value depends on the IP address of the client)
–without-http_map_module Disabling Ngx_http_map_module support (setting configuration variables with any key/value pair)
–without-http_split_clients_module disables Ngx_http_split_clients_module support, which is used to divide users based on certain conditions. Conditions such as: IP address, header, cookies, etc.)
–without-http_referer_module Disable Disable Ngx_http_referer_module support (this module is used to filter requests and reject requests for incorrect referer values in the header)
–without-http_rewrite_module disables Ngx_http_rewrite_module support, which allows the use of regular expressions to change URIs and to turn to and select configurations based on variables. If this option is set at the server level, they will take effect before location. If there are further rewrite rules at location, the rules of the location section will still be executed. If this URI rewrite is caused by a rule in the Location section, then the location section will be executed again as the new URI. This loop executes 10 times, and then Nginx returns a 500 error. )
–without-http_proxy_module disabling Ngx_http_proxy_module support (for proxy servers)
–without-http_fastcgi_module disables Ngx_http_fastcgi_module support, which allows Nginx to interact with the fastcgi process and control fastcgi process work by passing parameters. ) fastcgi a resident public gateway interface.
–without-http_uwsgi_module Disabling Ngx_http_uwsgi_module support (this module is used for medical UWSGI protocol, UWSGI server related)
–without-http_scgi_module disables Ngx_http_scgi_module support, which is used to enable SCGI protocol support, and the SCGI protocol is an alternative to the CGI protocol. It is an application-to-HTTP service interface standard. It's a bit like fastcgi but his design is easier to implement. )
–without-http_memcached_module Disabling Ngx_http_memcached_module support (this module is used to provide simple caching to improve system efficiency)
-without-http_limit_zone_module Disabling Ngx_http_limit_zone_module support (the module can control the number of concurrent connections to a session for a condition)
–without-http_limit_req_module Disable Ngx_http_limit_req_module Support (this module allows you to limit the number of requests to an address with a given session or a specific event)
–without-http_empty_gif_module Disable Ngx_http_empty_gif_module Support (the module resides in memory with a 1*1 transparent GIF image that can be called very quickly)
–without-http_browser_module disables Ngx_http_browser_module support, which is used to create a value that relies on the request header. If the browser is modern, $modern_browser equals the value assigned by the modern_browser_value instruction, or $ancient_browser equals Ancient_browser_ if the browser is old. Value assigned by the instruction, or $msie equals 1 if the browser is any version in MSIE)
–without-http_upstream_ip_hash_module Disabling Ngx_http_upstream_ip_hash_module support (this module is used for simple load balancing)
–with-http_perl_module Enable Ngx_http_perl_module Support (This module allows Nginx to directly use Perl or call Perl via SSI)
–with-perl_modules_path= Setting the Perl module path
–with-perl= Setting the Perl library file path
–http-log-path= Setting Access log path
–http-client-body-temp-path= setting HTTP Client Request temp file path
–http-proxy-temp-path= setting HTTP proxy temporary file path
–http-fastcgi-temp-path= Setting the HTTP fastcgi temp file path
–http-uwsgi-temp-path= Setting the HTTP Uwsgi temp file path
–http-scgi-temp-path= Setting the HTTP scgi temp file path
-without-http Disabling the HTTP Server feature
–without-http-cache Disabling the HTTP cache feature
–with-mail Enable POP3/IMAP4/SMTP Proxy module support
–with-mail_ssl_module Enable Ngx_mail_ssl_module Support
–without-mail_pop3_module disables the POP3 protocol (POP3, the 3rd version of the Post Office Protocol, which is a protocol that specifies how personal computers connect to mail servers on the Internet to send and receive mail. is the first offline protocol standard for Internet e-mail, the POP3 protocol allows users to store messages from the server on a local host while deleting or saving messages on the mail server based on the client's actions. The POP3 protocol is a member of the TCP/IP protocol family and is primarily used to support e-mail that is managed remotely on the server using a client.
–without-mail_imap_module disables the IMAP protocol, a message acquisition protocol. Its main function is that the mail client can obtain the message from the mail server through this protocol, download the Mail and so on. The IMAP protocol runs on top of the TCP/IP protocol, using a port of 143. The main difference between it and the POP3 protocol is that the user can not download all the messages, and can directly manipulate the messages on the server through the client. )
–without-mail_smtp_module disables the SMTP protocol (SMTP is the Simple Mail Transfer Protocol, which is a set of rules for sending mail from the source address to the destination, and it controls how the letters are brokered. The SMTP protocol belongs to the TCP/IP protocol family, which helps each computer find its next destination when sending or relaying letters. )
–with-google_perftools_module Enable Ngx_google_perftools_module support (Tune trial, profiler performance bottleneck)
–with-cpp_test_module Enable Ngx_cpp_test_module Support
–add-module= Enabling external module support
–with-cc= pointing to the C compiler path
–with-cpp= pointing 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, you can –with-cc- Opt= "-D fd_setsize=2048" designation. )
–with-ld-opt= 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, the available values are: Pentium, Pentiumpro, Pentium3, Pentium4, Athlon, Opteron, AMD64, Sparc32, SPARC64, PPC64
–without-pcre Disabling the Pcre library
–with-pcre Enabling the Pcre library
–with-pcre= point to Pcre library file directory
–with-pcre-opt= setting additional parameters for the Pcre library at compile time
–with-md5= points to the MD5 library file directory (message digest algorithm version fifth, which provides integrity protection for messages)
–with-md5-opt= setting additional parameters for the MD5 library at compile time
–with-md5-asm using MD5 assembler source
–with-sha1= points to the SHA1 Library directory (digital Signature algorithm, primarily for digital signatures)
–with-sha1-opt= setting additional parameters for the SHA1 library at compile time
–with-sha1-asm using SHA1 assembler source
–with-zlib= point to zlib Library directory
–with-zlib-opt= setting additional parameters for zlib at compile time
The –with-zlib-asm= is optimized for the specified CPU using the zlib assembler source, the CPU type is Pentium, and the Pentiumpro
–with-libatomic provides a schema for the implementation of an update operation for atomic memory
–with-libatomic= pointing to the Libatomic_ops installation directory
–with-openssl= pointing to the OpenSSL installation directory
–with-openssl-opt setting additional parameters for OpenSSL at compile time
–with-debug Enabling debug logging
Installation tutorial and compilation parameters in Linux under Nginx compilation