Lab Environment Description:
Operating system: Centos 7 64-bit
Nginx version: Nginx 1.12.2
Preparation before compiling the installation :
Install Nginx compile and install some packages that you need to rely on
Yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel Open openssl-devel-y
#Nginx的编译安装及编译参数详解
Nginx's compilation parameters explained
--prefix=path Set installation prefix #设置安装路径
--sbin-path=path set nginx binary pathname #设置binary path
--conf-path=path Set nginx.conf pathname #设置nginx configuration file path
--error-log-path=path Set error log pathname #设置错误日志路径
--pid-path=path set Nginx.pid pathname #设置nginx. PID Path
--lock-path=path set Nginx.lock pathname #设置nginx. Lock path
--user=user set non-privileged user for #设置没有特殊权限的用户执行worker processes
Worker processes
--group=group set non-privileged Group for #设置没有特殊权限的用户执行worker processes
Worker processes
--builddir=dir Set Build directory #设置编译目录
--with-rtsig_module Enable Rtsig module #开启rtsig modules
--with-select_module Enable Select module #开启select modules
--without-select_module Disable Select module #关闭 select Modules
--with-poll_module Enable poll Module #启用 poll modules
--without-poll_module Disable Poll Module #关闭poll modules
--with-file-aio Enable file AIO support #开启file AIO supported
--with-ipv6 Enable IPV6 support #开启IPv6
--with-http_ssl_module Enable Ngx_http_ssl_module #开启ssl module
--with-http_spdy_module Enable Ngx_http_spdy_module #开启spdy模块
--with-http_realip_module Enable Ngx_http_realip_module #开启 realip module
--with-http_addition_module Enable Ngx_http_addition_module #开启 addition module
--with-http_xslt_module enable Ngx_http_xslt_module #开启 XSLT module
--with-http_image_filter_module Enable Ngx_http_image_filter_module #开启 image_filter module
--with-http_geoip_module Enable Ngx_http_geoip_module #开启geoip模块
--with-http_sub_module Enable Ngx_http_sub_module #开启 sub Module
--with-http_dav_module Enable Ngx_http_dav_module #开启dav module
--with-http_flv_module enable Ngx_http_flv_module #开启 flv module
--with-http_mp4_module enable Ngx_http_mp4_module #开启 mp4 Module
--with-http_gunzip_module Enable Ngx_http_gunzip_module #开启gunzip模块
--with-http_gzip_static_module Enable Ngx_http_gzip_static_module #开启 gzip_static module
--with-http_auth_request_module Enable Ngx_http_auth_request_module #开启 auth_request (authentication request) module
--with-http_random_index_module Enable Ngx_http_random_index_module #开启random_index (random index) module
--with-http_secure_link_module Enable Ngx_http_secure_link_module #开启 Secure_link (secure link) module
--with-http_degradation_module Enable Ngx_http_degradation_module #开启degradation module
--with-http_stub_status_module Enable Ngx_http_stub_status_module #开启 stub_status module
--without-http_charset_module Disable Ngx_http_charset_module #关闭 charset (character set) module
--without-http_gzip_module Disable Ngx_http_gzip_module #关闭 gzip module
--without-http_ssi_module Disable Ngx_http_ssi_module #关闭 SSI module
--without-http_userid_module Disable Ngx_http_userid_module #关闭 userid module
--without-http_access_module Disable Ngx_http_access_module #关闭 access module
--without-http_auth_basic_module Disable Ngx_http_auth_basic_module #关闭 auth_basic (Basic authentication) module
--without-http_autoindex_module Disable Ngx_http_autoindex_module #关闭 autoindex (Auto-address) module
--without-http_geo_module Disable Ngx_http_geo_module #关闭 Geo module
--without-http_map_module Disable ngx_http_map_module #关闭 map module
--without-http_split_clients_module Disable Ngx_http_split_clients_module #关闭 split_clients (partition Client) module
--without-http_referer_module Disable Ngx_http_referer_module #关闭 referer (referrer) module
--without-http_rewrite_module Disable ngx_http_rewrite_module #关闭 rewrite (rewrite) module
--without-http_proxy_module Disable Ngx_http_proxy_module #关闭 proxy (proxy) module
--without-http_fastcgi_module Disable Ngx_http_fastcgi_module #关闭 fastcgi module
--without-http_uwsgi_module Disable Ngx_http_uwsgi_module #关闭 uwsgi module
--without-http_scgi_module Disable Ngx_http_scgi_module #关闭 scgi module
--without-http_memcached_module Disable Ngx_http_memcached_module #关闭 memcached module
--without-http_limit_conn_module Disable Ngx_http_limit_conn_module # close Limit_conn module
--without-http_limit_req_module Disable Ngx_http_limit_req_module #关闭 limit_req module
--without-http_empty_gif_module Disable Ngx_http_empty_gif_module #关闭 empty_gif module
--without-http_browser_module Disable ngx_http_browser_module #关闭 Browser module
--without-http_upstream_ip_hash_module
Disable Ngx_http_upstream_ip_hash_module #关闭 ip_hash module
--without-http_upstream_least_conn_module
Disable Ngx_http_upstream_least_conn_module #关闭 least_conn module
--without-http_upstream_keepalive_module
Disable Ngx_http_upstream_keepalive_module #关闭 keepalive module
--with-http_perl_module Enable Ngx_http_perl_module #开启perl module
--with-perl_modules_path=path Set Perl modules path #设置perl模块路径
--with-perl=path Set perl binary pathname #设置perl command path
--http-log-path=path Set HTTP access log Pathname #设置访问日志 path
--http-client-body-temp-path=path set Path to store
HTTP client request body temporary files #设置存储路径 HTTP clients requesting principal temporary files
--http-proxy-temp-path=path set Path to store
HTTP proxy Temporary Files #设置存储路径 HTTP Agent temp file
--http-fastcgi-temp-path=path set Path to store
HTTP fastcgi temporary files #设置 fastcgi temporary file storage path
--http-uwsgi-temp-path=path set Path to store
HTTP uwsgi temporary files #设置 uwsgi temporary file storage path
--http-scgi-temp-path=path set Path to store
HTTP scgi temporary files #设置 scgi temporary file storage path
--without-http Disable HTTP Server #关闭 HTTP server
--without-http-cache Disable HTTP cache #关闭 HTTP cache
--with-mail Enable POP3/IMAP4/SMTP Proxy module #开启 POP3/IMAP4/SMTP protocol modules
--with-mail_ssl_module Enable Ngx_mail_ssl_module #开启 nginx Mail SSL module
--without-mail_pop3_module Disable ngx_mail_pop3_module #关闭 mail POP3 module
--without-mail_imap_module disable ngx_mail_imap_module #关闭 mail IMAP module
--without-mail_smtp_module disable ngx_mail_smtp_module #关闭 mail SMTP module
--with-google_perftools_module Enable Ngx_google_perftools_module #开启 nginx Google_perftools (Google performance tools) module
--with-cpp_test_module Enable Ngx_cpp_test_module #开启 cpp_test module
--add-module=path enable an external module #开启external (external) modules
--with-cc=path set C compiler pathname #设置C compiler path
--with-cpp=path Set C preprocessor pathname #设置 C pre-compiler path
--with-cc-opt=options set additional C compiler OPTIONS #设置额外的C编译器选项
--with-ld-opt=options SET additional linker OPTIONS #设置额外的链接器选项
--WITH-CPU-OPT=CPU build for the specified CPU, valid values:
Pentium, Pentiumpro, PENTIUM3, PENTIUM4,
Athlon, Opteron, Sparc32, SPARC64, PPC64 #建立指定的CPU Valid values:
--without-pcre Disable Pcre library usage #关闭 pcre libraries
--with-pcre Force Pcre Library Usage #强制使用指定的PCRE Gallery
--with-pcre=dir set path to Pcre library sources #指定 pcre using paths
--with-pcre-opt=options set additional build OPTIONS for Pcre #为PCRE设置额外的构建选项
--with-pcre-jit build Pcre with JIT compilation support #构建PCRE JIT compilation
--with-md5=dir set path to MD5 library sources #设置路径md5库资源
--with-md5-opt=options set additional build OPTIONS for MD5 #为md5设置额外的构建选项
--with-md5-asm use MD5 assembler sources #使用md5汇编源
--with-sha1=dir set path to SHA1 library sources #设置 SHA1 libraries
--with-sha1-opt=options set additional build OPTIONS for SHA1 #为sha1设置额外的构建选项
--with-sha1-asm use SHA1 assembler sources #使用sha1汇编源
--with-zlib=dir set path to zlib library sources #指定 zlib libraries
--with-zlib-opt=options set additional build option for Zlib #为zlib setting additional build options
--with-zlib-asm=cpu use zlib assembler sources optimized
For the specified CPU, valid values:
Pentium, Pentiumpro #使用 zlib compilation of optimized sources
--with-libatomic Force Libatomic_ops Library usage #强制 use libatomic
--with-libatomic=dir set path to Libatomic_ops library sources #设置 libatomic paths
--with-openssl=dir set path to OpenSSL library sources #设置 OpenSSL libraries
--with-openssl-opt=options set additional build options for OpenSSL #为 OpenSSL setting additional build option
--with-debug Enable debug Logging #开启debug Log
Nginx's Compile step:
First, execute the Configure script in the Nginx source package
Decompression Nginx source package, into the directory of Nginx source package decompression, execute configure script, generate makefile file.
When I generate the makefile file, I use the following compilation parameters
./configure--prefix=/usr/local/nginx--conf-path=/etc/nginx/nginx.conf--user=nginx--group=nginx--error-log-path =/var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log--pid-path=/var/run/nginx/nginx.pid-- Lock-path=/var/lock/nginx.lock--with-http_ssl_module--with-http_stub_status_module--with-http_gzip_static_ Module--with-http_flv_module--with-http_mp4_module--http-client-body-temp-path=/var/tmp/nginx/client-- Http-proxy-temp-path=/var/tmp/nginx/proxy--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi--with-debug
Second, compile and install using make command and do install command
Make && make install
So far, our Nginx program has been installed.
Nginx compiler installation and compilation parameters explained