Nginx編譯安裝及編譯參數講解

來源:互聯網
上載者:User

標籤:檔案路徑   mp4   .com   mem   filter   分享   processes   mpi   bug   


實驗環境說明:
作業系統:Centos 7 64位
Nginx版本:Nginx 1.12.2

編譯安裝前的準備
安裝Nginx編譯安裝需要依賴的一些包
yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel -y

#Nginx的編譯安裝及編譯參數詳解

Nginx的編譯參數講解
--prefix=PATH set installation prefix #設定安裝路徑
--sbin-path=PATH set nginx binary pathname #設定binary 路徑
--conf-path=PATH set nginx.conf pathname #設定nginx 設定檔路徑
--error-log-path=PATH set error log pathname #設定錯誤記錄檔路徑
--pid-path=PATH set nginx.pid pathname #設定nginx.pid 路徑
--lock-path=PATH set nginx.lock pathname #設定nginx.lock路徑

--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 模組
--with-select_module enable select module #開啟select 模組
--without-select_module disable select module #關閉 select 模組
--with-poll_module enable poll module #啟用 poll 模組
--without-poll_module disable poll module #關閉poll 模組

--with-file-aio enable file AIO support #開啟file AIO支援
--with-ipv6 enable IPv6 support #開啟IPv6 支援

--with-http_ssl_module enable ngx_http_ssl_module #開啟ssl 模組
--with-http_spdy_module enable ngx_http_spdy_module #開啟spdy模組
--with-http_realip_module enable ngx_http_realip_module #開啟 realip 模組
--with-http_addition_module enable ngx_http_addition_module #開啟 addition 模組
--with-http_xslt_module enable ngx_http_xslt_module #開啟 xslt模組
--with-http_image_filter_module enable ngx_http_image_filter_module #開啟 image_filter模組
--with-http_geoip_module enable ngx_http_geoip_module #開啟geoip模組
--with-http_sub_module enable ngx_http_sub_module #開啟 sub模組
--with-http_dav_module enable ngx_http_dav_module #開啟dav 模組
--with-http_flv_module enable ngx_http_flv_module #開啟 flv模組
--with-http_mp4_module enable ngx_http_mp4_module #開啟 mp4模組
--with-http_gunzip_module enable ngx_http_gunzip_module #開啟gunzip模組
--with-http_gzip_static_module enable ngx_http_gzip_static_module #開啟 gzip_static模組
--with-http_auth_request_module enable ngx_http_auth_request_module #開啟 auth_request(身分識別驗證請求)模組
--with-http_random_index_module enable ngx_http_random_index_module #開啟random_index(隨機指數)模組
--with-http_secure_link_module enable ngx_http_secure_link_module #開啟 secure_link(安全連結)模組
--with-http_degradation_module enable ngx_http_degradation_module #開啟degradation 模組
--with-http_stub_status_module enable ngx_http_stub_status_module #開啟 stub_status 模組

--without-http_charset_module disable ngx_http_charset_module #關閉 charset(字元集) 模組
--without-http_gzip_module disable ngx_http_gzip_module #關閉 gzip模組
--without-http_ssi_module disable ngx_http_ssi_module #關閉 ssi 模組
--without-http_userid_module disable ngx_http_userid_module #關閉 userid模組
--without-http_access_module disable ngx_http_access_module #關閉 access模組
--without-http_auth_basic_module disable ngx_http_auth_basic_module #關閉 auth_basic (基本身份認證)模組
--without-http_autoindex_module disable ngx_http_autoindex_module #關閉 autoindex(自動變址)模組
--without-http_geo_module disable ngx_http_geo_module #關閉 geo模組
--without-http_map_module disable ngx_http_map_module #關閉 map 模組
--without-http_split_clients_module disable ngx_http_split_clients_module #關閉 split_clients (劃分用戶端)模組
--without-http_referer_module disable ngx_http_referer_module #關閉 referer (推薦人)模組
--without-http_rewrite_module disable ngx_http_rewrite_module #關閉 rewrite (重寫)模組
--without-http_proxy_module disable ngx_http_proxy_module #關閉 proxy (代理)模組
--without-http_fastcgi_module disable ngx_http_fastcgi_module #關閉 fastcgi模組
--without-http_uwsgi_module disable ngx_http_uwsgi_module #關閉 uwsgi 模組
--without-http_scgi_module disable ngx_http_scgi_module #關閉 scgi 模組
--without-http_memcached_module disable ngx_http_memcached_module #關閉 memcached 模組
--without-http_limit_conn_module disable ngx_http_limit_conn_module # 關閉 limit_conn 模組
--without-http_limit_req_module disable ngx_http_limit_req_module #關閉 limit_req模組
--without-http_empty_gif_module disable ngx_http_empty_gif_module #關閉 empty_gif 模組
--without-http_browser_module disable ngx_http_browser_module #關閉 browser 模組
--without-http_upstream_ip_hash_module
disable ngx_http_upstream_ip_hash_module #關閉 ip_hash模組
--without-http_upstream_least_conn_module
disable ngx_http_upstream_least_conn_module #關閉 least_conn 模組
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module #關閉 keepalive 模組

--with-http_perl_module enable ngx_http_perl_module #開啟perl 模組
--with-perl_modules_path=PATH set Perl modules path #設定perl模組路徑
--with-perl=PATH set perl binary pathname #設定perl 命令路徑

--http-log-path=PATH set http access log pathname #設定訪問日誌 路徑
--http-client-body-temp-path=PATH set path to store
http client request body temporary files #設定儲存路徑 http用戶端請求主體臨時檔案
--http-proxy-temp-path=PATH set path to store
http proxy temporary files #設定儲存路徑 http代理臨時檔案
--http-fastcgi-temp-path=PATH set path to store
http fastcgi temporary files #設定 fastcgi臨時檔案儲存體路徑
--http-uwsgi-temp-path=PATH set path to store
http uwsgi temporary files #設定 uwsgi 臨時檔案儲存體路徑
--http-scgi-temp-path=PATH set path to store
http scgi temporary files #設定 scgi 臨時檔案儲存體路徑

--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 協議模組
--with-mail_ssl_module enable ngx_mail_ssl_module #開啟 nginx mail ssl 模組
--without-mail_pop3_module disable ngx_mail_pop3_module #關閉 mail pop3模組
--without-mail_imap_module disable ngx_mail_imap_module #關閉 mail imap 模組
--without-mail_smtp_module disable ngx_mail_smtp_module #關閉 mail smtp 模組

--with-google_perftools_module enable ngx_google_perftools_module #開啟 nginx google_perftools (Google效能工具)模組
--with-cpp_test_module enable ngx_cpp_test_module #開啟 cpp_test 模組

--add-module=PATH enable an external module #開啟external(外部)模組

--with-cc=PATH set C compiler pathname #設定C 編譯器 路徑
--with-cpp=PATH set C preprocessor pathname #設定 C先行編譯器 路徑
--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 有效值:

--without-pcre disable PCRE library usage #關閉 PCRE 庫 使用
--with-pcre force PCRE library usage #強制使用指定的PCRE 庫
--with-pcre=DIR set path to PCRE library sources #指定 pcre 使用路徑
--with-pcre-opt=OPTIONS set additional build options for PCRE #為PCRE設定額外的構建選項
--with-pcre-jit build PCRE with JIT compilation support #構建PCRE JIT編譯的支援

--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 庫的路徑
--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 庫的路徑
--with-zlib-opt=OPTIONS set additional build options for zlib #為zlib 設定額外的構建選項
--with-zlib-asm=CPU use zlib assembler sources optimized
for the specified CPU, valid values:
pentium, pentiumpro #使用 zlib彙編最佳化的來源

--with-libatomic force libatomic_ops library usage #強制 使用libatomic
--with-libatomic=DIR set path to libatomic_ops library sources #設定 libatomic 路徑

--with-openssl=DIR set path to OpenSSL library sources #設定 openssl 庫的路徑
--with-openssl-opt=OPTIONS set additional build options for OpenSSL #為 openssl 設定額外的構建選項

--with-debug enable debug logging #開啟debug 日誌

Nginx的編譯步驟:
一、執行nginx源碼包中的configure指令碼
解壓nginx的源碼包,進入nginx源碼包解壓後的目錄中,執行configure指令碼,產生makefile檔案。
我在產生makefile檔案時,使用以下編譯參數
./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

二、使用make命令和make install命令進行編譯安裝
make && make install

到此為止,我們我們的nginx程式就安裝好了。

Nginx編譯安裝及編譯參數講解

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.