1. 程式人生 > 其它 >Nginx編譯安裝引數與目錄詳解 nginx編譯安裝之-./configure 引數詳解

Nginx編譯安裝引數與目錄詳解 nginx編譯安裝之-./configure 引數詳解

nginx編譯安裝之-./configure 引數詳解

 參考官方文件

 http://nginx.org/en/docs/configure.html

 --with開頭的,預設是禁用的(沒啟動的,想使用的話需要在編譯的時候加上)

 --without開頭的,預設是啟用的(不想啟用此模組時,可以在編譯的時候加上這個引數)

 編譯安裝示例

./configure --prefix=/usr/local/nginx \ 
--sbin-path=/usr/local/nginx/sbin/nginx \ 
--conf-path=/usr/local/nginx/conf/nginx.conf \ 
--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 \ 
--user=nginx \ 
--group=nginx \ 
--with-http_ssl_module \ 
--with-http_gzip_static_module \ 
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ 
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ 
--http-scgi-temp-path=/var/tmp/nginx/scgi \ 
--with-pcre

 2.引數講解

 --prefix=  指向安裝目錄。

 --sbin-path=  指定執行程式檔案存放位置。

 --modules-path=  指定第三方模組的存放路徑。

 --conf-path= 指定配置檔案存放位置。

 --error-log-path=  指定錯誤日誌存放位置。

 --pid-path=  指定pid檔案存放位置。

 --lock-path=  指定lock檔案存放位置。

 --user=  指定程式執行時的非特權使用者。

 --group=  指定程式執行時的非特權使用者組。

 --builddir=  指向編譯目錄。

 --with-rtsig_module  啟用rtsig模組支援。

 --with-select_module  啟用select模組支援,一種輪詢處理方式,不推薦在高併發環境中使用,禁用:--without-select_module。

 --with-poll_module  啟用poll模組支援,功能與select相同,不推薦在高併發環境中使用。

 --with-threads 啟用thread pool支援。

 --with-file-aio  啟用file aio支援。

 --with-http_ssl_module 啟用https支援。

 --with-http_v2_module    啟用ngx_http_v2_module支援。

 --with-ipv6    啟用ipv6支援。

 --with-http_realip_module    允許從請求報文頭中更改客戶端的ip地址,預設為關。

 --with-http_addition_module    啟用ngix_http_additon_mdoule支援(作為一個輸出過濾器,分部分響應請求)。

 --with -http_xslt_module    啟用ngx_http_xslt_module支援,過濾轉換XML請求 。

 --with-http_image_filter_mdoule  啟用ngx_http_image_filter_module支援,傳輸JPEG\GIF\PNG圖片的一個過濾器,預設不啟用,需要安裝gd庫。

 --with-http_geoip_module  啟用ngx_http_geoip_module支援,用於建立基於MaxMind GeoIP二進位制檔案相配的客戶端IP地址的ngx_http_geoip_module變數。

 --with-http_sub_module  啟用ngx_http_sub_module支援,允許用一些其他文字替換nginx響應中的一些文字。

 --with-http_dav_module  啟用ngx_http_dav_module支援,增加PUT、DELETE、MKCOL建立集合,COPY和MOVE方法,預設為關閉,需要編譯開啟。

 --with-http_flv_module  啟用ngx_http_flv_module支援,提供尋求記憶體使用基於時間的偏移量檔案。

 --with-http_mp4_module  啟用ngx_http_mp4_module支援,啟用對mp4類視訊檔案的支援。

 --with-http_gzip_static_module  啟用ngx_http_gzip_static_module支援,支援線上實時壓縮輸出資料流。

 --with-http_random_index_module  啟用ngx_http_random_index_module支援,從目錄中隨機挑選一個目錄索引。

 --with-http_secure_link_module  啟用ngx_http_secure_link_module支援,計算和檢查要求所需的安全連結網址。

 --with-http_degradation_module  啟用ngx_http_degradation_module 支援允許在記憶體不足的情況下返回204或444程式碼。

 --with-http_stub_status_module  啟用ngx_http_stub_status_module 支援檢視nginx的狀態頁。

 --without-http_charset_module  禁用ngx_http_charset_module這一模組,可以進行字符集間的轉換,從其它字元轉換成UTF-8或者從UTF8轉換成其它字元。它只能從伺服器到客戶端方向,只有一個位元組的字元可以轉換。

 --without-http_gzip_module  禁用ngx_http_gzip_module支援,同--with-http_gzip_static_module功能一樣。

 --without-http_ssi_module  禁用ngx_http_ssi_module支援,提供了一個在輸入端處理伺服器包含檔案(SSI)的過濾器。

 --without-http_userid_module  禁用ngx_http_userid_module支援,該模組用來確定客戶端後續請求的cookies。

 --without-http_access_module  禁用ngx_http_access_module支援,提供了基於主機ip地址的訪問控制功能。

 --without-http_auth_basic_module  禁用ngx_http_auth_basic_module支援,可以使用使用者名稱和密碼認證的方式來對站點或部分內容進行認證。

 --without-http_autoindex_module  禁用ngx_http_authindex_module,該模組用於在ngx_http_index_module模組沒有找到索引檔案時發出請求,用於自動生成目錄列表。

 --without-http_geo_module  禁用ngx_http_geo_module支援,這個模組用於建立依賴於客戶端ip的變數。

 --without-http_map_module  禁用ngx_http_map_module支援,使用任意的鍵、值 對設定配置變數。

 --without-http_split_clients_module 禁用ngx_http_split_clients_module支援,該模組用於基於使用者ip地址、報頭、cookies劃分使用者。

 --without-http_referer_module  禁用ngx_http_referer_modlue支援,該模組用來過濾請求,報頭中Referer值不正確的請求。

 --without-http_rewrite_module  禁用ngx_http_rewrite_module支援。該模組允許使用正則表示式改變URI,並且根據變數來轉向以及選擇配置。如果在server級別設定該選項,那麼將在location之前生效,但如果location中還有更進一步的重寫規則,location部分的規則依然會被執行。如果這個URI重寫是因為location部分的規則造成的,那麼location部分會再次被執行作為新的URI,這個迴圈會被執行10次,最後返回一個500錯誤。

 --without-http_proxy_module  禁用ngx_http_proxy_module支援,http代理功能。

 --without-http_fastcgi_module  禁用ngx_http_fastcgi_module支援,該模組允許nginx與fastcgi程序互動,並通過傳遞引數來控制fastcgi程序工作。

 --without-http_uwsgi_module  禁用ngx_http_uwsgi_module支援,該模組用來使用uwsgi協議,uwsgi伺服器相關。

 --without-http_scgi_module  禁用ngx_http_scgi_module支援,類似於fastcgi,也是應用程式與http服務的介面標準。

 --without-http_memcached_module  禁用ngx_http_memcached支援,用來提供簡單的快取,提高系統效率。

 --without-http_limit_conn_module  禁用ngx_http_limit_conn_module支援,該模組可以根據條件進行會話的併發連線數進行限制。

 --without-http_limit_req_module  禁用ngx_limit_req_module支援,該模組可以實現對於一個地址進行請求數量的限制。

 --without-http_empty_gif_module  禁用ngx_http_empty_gif_module支援,該模組在記憶體中常駐了一個1*1的透明gif影象,可以被非常快速的呼叫。

 --without-http_browser_module  禁用ngx_http_browser_mdoule支援,建立依賴於請求報頭的值 。如果瀏覽器為modern,則$modern_browser等於modern_browser_value的值;如果瀏覽器為old,則$ancient_browser等於$ancient_browser_value指令分配的值;如果瀏覽器為MSIE,則$msie等於1。

 --without-http_upstream_ip_hash_module 禁用ngx_http_upstream_ip_hash_module支援,該模組用於簡單的負載均衡。

 --with-http_perl_module  啟用ngx_http_perl_module支援,它使nginx可以直接使用perl或通過ssi呼叫perl。

 --with-perl_modules_path=  設定perl模組路徑

 --with-perl=  設定perl庫檔案路徑

 --http-log-path=  設定access log路徑

 --http-client-body-temp-path=  設定http客戶端請求臨時檔案路徑

 --http-proxy-temp-path=  設定http代理臨時檔案路徑

 --http-fastcgi-temp-path=  設定http fastcgi臨時檔案路徑

 --http-uwsgi-temp-path=  設定http scgi臨時檔案路徑

 --http-scgi-temp-path=  設定http scgi臨時檔案路徑

 --without-http  禁用http server功能

 --without-http-cache  禁用http cache功能

 --with-mail  啟用POP3、IMAP4、SMTP代理模組

 --with-mail_ssl_module  啟用ngx_mail_ssl_module支援

 --without-mail_pop3_module  禁用pop3協議。

 --without-mail_iamp_module  禁用iamp協議。

 --without-mail_smtp_module  禁用smtp協議。

 --with-google_perftools_module  啟用ngx_google_perftools_mdoule支援,除錯用,可以用來分析程式效能瓶頸。

 --with-cpp_test_module 啟用ngx_cpp_test_module支援。

 --add-module=  指定外部模組路徑,啟用對外部模組的支援。

 --with-cc=  指向C編譯器路徑。

 --with-cpp=  指向C預處理路徑。

 --with-cc-opt=  設定C編譯器引數,指定--with-cc-opt="-I /usr/lcal/include",如果使用select()函式,還需要同時指定檔案描述符數量--with-cc-opt="-D FD_SETSIZE=2048"。 (PCRE庫)

 --with-ld-opt=  設定連線檔案引數,需要指定--with-ld-opt="-L /usr/local/lib"。(PCRE庫)

 --with-cpu-opt=  指定編譯的CPU型別,如pentium,pentiumpro,...amd64,ppc64...

 --without-pcre  禁用pcre庫。

 --with-pcre  啟用pcre庫。

 --with-pcre=  指向pcre庫檔案目錄。

 --with-pcre-opt=  在編譯時為pcre庫設定附加引數 。

 --with-md5=  指向md5庫檔案目錄。

 --with-md5-opt=  編譯時為md5庫設定附加引數。

 --with-md5-asm  使用md5彙編源。

 --with-sha1=  指向sha1庫檔案目錄。

 --with-sha1-opt=  編譯時為sha1庫設定附加引數。

 --with-sha1-asm  使用sha1彙編源。

 --with-zlib=  指向zlib庫檔案目錄。

 --with-zlib-opt=  在編譯時為zlib設定附加引數。

 --with-zlib-asm=  為指定的CPU使用匯編源進行優化。

 --with-libatomic  為原子記憶體的更新操作的實現提供一個架構。

 --with-libatomic=  指向libatomic_ops的安裝目錄。

 --with-openssl=  指向openssl安裝目錄。

 --with-openssl-opt=  在編譯時為openssl設定附加引數。

 --with-debug  啟用debug日誌。

 3. 預設withwithout的選項

 

選項(功能)

with

without

預設

prefix

N/A

N/A

/usr/local/nginx

sbin-path

N/A

N/A

prefix/sbin/nginx

conf-path

N/A

N/A

prefix/conf/nginx.conf

pid-path

N/A

N/A

prefix/logs/nginx.pid

error-log-path

N/A

N/A

prefix/logs/error.log

http-log-path

N/A

N/A

prefix/logs/access.log

user

N/A

N/A

nobody

group

N/A

N/A

nobody

select_module

with

without

如果平臺不支援kqueue,epoll,/dev/poll,它將作為自動選擇的事務處理方式

poll_module

with

without

如果平臺不支援kqueue,epoll,/dev/poll,它將作為自動選擇的事務處理方式

file_aio

with

N/A

關閉

ipv6

with

N/A

關閉

http_ssl_module

with

N/A

關閉

http_realip_module

with

N/A

關閉

http_addition_module

with

N/A

關閉

http_xslt_module

with

N/A

關閉

http_image_filter_module

with

N/A

關閉

http_geoip_module

with

N/A

關閉

http_sub_module

with

N/A

關閉

http_dav_module

with

N/A

關閉

http_flv_module

with

N/A

關閉

http_gzip_static_module

with

N/A

關閉

http_random_index_module

with

N/A

關閉

http_secure_link_module

with

N/A

關閉

http_degradation_module

with

N/A

關閉

http_stub_status_module

with

N/A

關閉

http_charset_module

N/A

without

啟用

http_gzip_module

N/A

without

啟用

http_ssi_module

N/A

without

啟用

http_userid_module

N/A

without

啟用

http_access_module

N/A

without

啟用

http_auth_basic_module

N/A

without

啟用

http_autoindex_module

N/A

without

啟用

http_geo_module

N/A

without

啟用

http_map_module

N/A

without

啟用

http_split_clients_module

N/A

without

啟用

http_referer_module

N/A

without

啟用

http_rewrite_module

N/A

without

啟用

http_proxy_module

N/A

without

啟用

http_fastcgi_module

N/A

without

啟用

http_uwsgi_module

N/A

without

啟用

http_scgi_module

N/A

without

啟用

http_memcached_module

N/A

without

啟用

http_limit_conn_module

N/A

without

啟用

http_limit_req_module

N/A

without

啟用

http_empty_gif_module

N/A

without

啟用

http_brower_module

N/A

without

啟用

http_upstream_ip_hash_module

N/A

without

啟用

http_perl_module

with

N/A

禁用

http

N/A

without

啟用

http-cache

N/A

without

啟用

mail

with

N/A

禁用

pcre

with

without

N/A

stream

with

N/A

禁用

 

目錄詳解

路徑   型別 作用
/usr/local/logrotate.d/nginx 配置檔案 Nginx日誌輪轉,用於logrotate服務的日誌切割

/usr/local/nginx
/usr/local/nginx/nginx.conf
/usr/local/nginx/conf.d
/usr/local/nginx/conf.d/default.conf

目錄

配置檔案

是Nginx主配置檔案。

nginx.conf:啟動的時候讀;

default.conf:nginx在沒有變更的時候讀,nginx安裝後,server預設載入檔案;

/usr/local/nginx/fastcgi_params
/usr/local/nginx/uwsgi_params
/usr/local/nginx/scgi_params

 


配置檔案

 cgi配置相關,fastcgi配置

/usr/local/nginx/koi-utf
/usr/local/nginx/koi-win
/usr/local/nginx/win-utf

配置檔案  編碼轉換對映轉化檔案
/usr/local/nginx/mime.types 配置檔案  設定http協議的Content-Type與副檔名對應關係

/usr/local/nginx/modules

目錄  Nginx模組目錄

/usr/local/sbin/nginx
/usr/local/sbin/nginx-debug

命令  Nginx服務的啟動管理的終端命令

/usr/local/share/doc/nginx-1.12.0
/usr/local/share/doc/nginx-xxx/COPYRIGHT
/usr/local/share/man/man8/nginx.8.gz

檔案

目錄

 Nginx的手冊和幫助檔案

/var/tmp/cache/nginx

目錄  Nginx的快取目錄

/var/tmp/log/nginx

目錄  Nginx的日誌目錄