1. 程式人生 > >centOS7環境nginx做TCP負載均衡

centOS7環境nginx做TCP負載均衡

七. 編譯原始碼
  先使用./configure –help 檢視編譯幫助:
  我的線上編譯引數,預設開啟的不用寫
  ./configure --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-stream  --with-stream_ssl_module --with-pcre
./configure --help 

  --help                            print this message 

  --prefix=PATH                      set installation prefix #Nginx安裝的根路徑,預設為 /usr/local/nginx。 

  --sbin-path=PATH                  set nginx binary pathname #指定nginx二進位制檔案的路徑,預設為PATH/sbin/nginx。 
  --modules-path=PATH                set modules path #Perl模組位置 
  --conf-path=PATH                  set nginx.conf pathname #設定nginx配置檔案地址,預設為PATH/conf/nginx.conf。 
  --error-log-path=PATH              set error log pathname #錯誤檔案路徑,預設為 PATH/logs/error.log。 

  --pid-path=PATH                    set nginx.pid pathname # master程序pid寫入的檔案位置,通常在var/run下,預設為 PATH/logs/nginx.pid。 
  --lock-path=PATH                  set nginx.lock pathname #共享儲存器互斥鎖檔案路徑 

  --user=USER                        set non-privileged user for worker processes #指定程式執行時的非特權使用者 
  --group=GROUP                      set non-privileged group for worker processes #指定程式執行時的非特權使用者組 


  --build=NAME                      set build name #編譯名稱 
  --builddir=DIR                    set build directory #指向編譯目錄 

  --with-select_module              enable select module 允許或不允許開啟SELECT模式,如果configure沒有找到合適的模式,比如,kqueue(sun os)、epoll(linux kenel 2.6+)、rtsig(實時訊號) 
  --without-select_module            disable select module 禁用select模組支援 
  --with-poll_module                enable poll module 啟用poll模組支援(功能與select相同,與select特性相同,為一種輪詢模式,不推薦在高載環境下使用) 
  --without-poll_module              disable poll module 禁用poll模組支援 

  --with-threads                    enable thread pool support 

  --with-file-aio                    enable file AIO support #為freeBSD4.3+和linux2.6.22+系統啟用非同步io 

  --with-ipv6                        enable IPv6 support #啟用ipv6支援 

#預設禁用的模組 
  --with-http_ssl_module            enable ngx_http_ssl_module #使支援https請求,需已安裝openssl 
  --with-http_v2_module              enable ngx_http_v2_module #啟用HTTP V2 
  --with-http_realip_module          enable ngx_http_realip_module #此模組支援顯示真實來源IP地址,主要用於NGINX做前端負載均衡伺服器使用 
  --with-http_addition_module        enable ngx_http_addition_module #輸出過濾器,使你能夠在請求經過一個location前或後時在該location本身新增內容 
  --with-http_xslt_module            enable ngx_http_xslt_module #這個模組是一個過濾器,它可以通過XSLT模板轉換XML應答 
  --with-http_xslt_module=dynamic    enable dynamic ngx_http_xslt_module  
  --with-http_image_filter_module    enable ngx_http_image_filter_module #影象過濾器,在將影象投遞到客戶之前進行處理(需要libgd庫) 
  --with-http_image_filter_module=dynamic 
                                    enable dynamic ngx_http_image_filter_module  
  --with-http_geoip_module          enable ngx_http_geoip_module #建立基於與MaxMind GeoIP相配的客戶端地址 
  --with-http_geoip_module=dynamic  enable dynamic ngx_http_geoip_module 
  --with-http_sub_module            enable ngx_http_sub_module #這個模組可以能夠在nginx的應答中搜索並替換文字 
  --with-http_dav_module            enable ngx_http_dav_module #為檔案和目錄指定許可權,限制不同型別的使用者對於頁面有不同的操作許可權 
  --with-http_flv_module            enable ngx_http_flv_module #這個模組支援對FLV(flash)檔案的拖動播放 
  --with-http_mp4_module            enable ngx_http_mp4_module #支援H.264/AAC檔案為偽流媒體 
  --with-http_gunzip_module          enable ngx_http_gunzip_module #對於不支援gzip編碼的客戶,該模組用於為客戶解壓縮預壓縮內容 
  --with-http_gzip_static_module    enable ngx_http_gzip_static_module #這個模組在一個預壓縮檔案傳送到開啟Gzip壓縮的客戶端之前檢查是否已經存在以“.gz”結尾的壓縮檔案,這樣可以防止檔案被重複壓縮 
  --with-http_auth_request_module    enable ngx_http_auth_request_module  
  --with-http_random_index_module    enable ngx_http_random_index_module #從目錄中選擇一個隨機主頁 
  --with-http_secure_link_module    enable ngx_http_secure_link_module #該模組提供一種機制,它會將一個雜湊值連結到一個url中,因此,只有那些使用正確的密碼能夠計算連結 
  --with-http_degradation_module    enable ngx_http_degradation_module #允許在記憶體不足的情況下返回204或444碼 
  --with-http_slice_module          enable ngx_http_slice_module  
  --with-http_stub_status_module    enable ngx_http_stub_status_module #取得一些nginx的執行狀態,輸出的狀態資訊可使用RRDtool或類似的工具繪製成圖 
#預設啟用的模組 
  --without-http_charset_module      disable ngx_http_charset_module #重新編碼web頁面 
  --without-http_gzip_module        disable ngx_http_gzip_module #同-with-http_gzip_static_module功能一樣 
  --without-http_ssi_module          disable ngx_http_ssi_module #提供在輸入端處理處理伺服器包含檔案(SSI)的過濾器,目前支援SSI命令的列表是不完整的 
  --without-http_userid_module      disable ngx_http_userid_module #用來處理用來確定客戶端後續請求的cookies 
  --without-http_access_module      disable ngx_http_access_module #供了一個簡單的基於主機的訪問控制。允許/拒絕基於ip地址 
  --without-http_auth_basic_module  disable ngx_http_auth_basic_module #可以使用使用者名稱和密碼基於http基本認證方法來保護你的站點或其部分內容 
  --without-http_autoindex_module    disable ngx_http_autoindex_module #自動生成目錄列表,只在ngx_http_index_module模組未找到索引檔案時發出請求。 
  --without-http_geo_module          disable ngx_http_geo_module #建立一些變數,其值依賴於客戶端的IP地址 
  --without-http_map_module          disable ngx_http_map_module #使用任意的鍵/值對設定配置變數 
  --without-http_split_clients_module disable ngx_http_split_clients_module #用來基於某些條件劃分使用者。條件如:ip地址、報頭、cookies等等 
  --without-http_referer_module      disable ngx_http_referer_module #用來過濾請求,拒絕報頭中Referer值不正確的請求 
  --without-http_rewrite_module      disable ngx_http_rewrite_module #允許使用正則表示式改變URI,並且根據變數來轉向以及選擇配置 
  --without-http_proxy_module        disable ngx_http_proxy_module #有關代理伺服器 
  --without-http_fastcgi_module      disable ngx_http_fastcgi_module #允許Nginx 與FastCGI 程序互動,並通過傳遞引數來控制FastCGI 程序工作。 
  --without-http_uwsgi_module        disable ngx_http_uwsgi_module #用來使用uwsgi協議,uWSGI伺服器相關 
  --without-http_scgi_module        disable ngx_http_scgi_module #用來啟用SCGI協議支援,SCGI協議是CGI協議的替代。 
  --without-http_memcached_module    disable ngx_http_memcached_module #用來提供簡單的快取,以提高系統效率 
  --without-http_limit_conn_module  disable ngx_http_limit_conn_module #允許你對於一個地址進行連線數的限制用一個給定的session或一個特定的事件 
  --without-http_limit_req_module    disable ngx_http_limit_req_module #允許你對於一個地址進行請求數量的限制用一個給定的session或一個特定的事件 
  --without-http_empty_gif_module    disable ngx_http_empty_gif_module #在記憶體中常駐了一個1*1的透明GIF影象,可以被非常快速的呼叫 
  --without-http_browser_module      disable ngx_http_browser_module #用來建立依賴於請求報頭的值 
  --without-http_upstream_hash_module 
                                    disable ngx_http_upstream_hash_module #用於簡單的負載均衡 
  --without-http_upstream_ip_hash_module 
                                    disable ngx_http_upstream_ip_hash_module  
  --without-http_upstream_least_conn_module 
                                    disable ngx_http_upstream_least_conn_module  
  --without-http_upstream_keepalive_module 
                                    disable ngx_http_upstream_keepalive_module 
  --without-http_upstream_zone_module 
                                    disable ngx_http_upstream_zone_module 

  --with-http_perl_module            enable ngx_http_perl_module #這個模組允許nginx使用SSI呼叫perl或直接執行perl(使用會降低效能) 
  --with-http_perl_module=dynamic    enable dynamic ngx_http_perl_module 
  --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 #設定access log路徑 
  --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 #設定http fastcgi臨時檔案路徑 
  --http-uwsgi-temp-path=PATH        set path to store http uwsgi temporary files #設定http uwsgi臨時檔案路徑 
  --http-scgi-temp-path=PATH        set path to store http scgi temporary files #設定http scgi臨時檔案路徑 

  --without-http                    disable HTTP server #完全禁用http模組,如果只想支援mall,可以使用此項設定 
  --without-http-cache              disable HTTP cache #在使用upstream模組時,nginx能夠配置本地快取內容,此選項可禁用快取 

  --with-mail                        enable POP3/IMAP4/SMTP proxy module #啟用POP3/IMAP4/SMTP代理模組,預設未啟用 
  --with-mail=dynamic                enable dynamic POP3/IMAP4/SMTP proxy module 
  --with-mail_ssl_module            enable ngx_mail_ssl_module #SMTP可以使用SSL/TLS.配置已經定義了HTTP 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-stream                      enable TCP/UDP proxy module 
  --with-stream=dynamic              enable dynamic TCP/UDP proxy module 
  --with-stream_ssl_module          enable ngx_stream_ssl_module 
  --without-stream_limit_conn_module disable ngx_stream_limit_conn_module 
  --without-stream_access_module    disable ngx_stream_access_module 
  --without-stream_upstream_hash_module 
                                    disable ngx_stream_upstream_hash_module 
  --without-stream_upstream_least_conn_module 
                                    disable ngx_stream_upstream_least_conn_module 
  --without-stream_upstream_zone_module 
                                    disable ngx_stream_upstream_zone_module 

  --with-google_perftools_module    enable ngx_google_perftools_module #除錯用,剖析程式效能瓶頸 
  --with-cpp_test_module            enable ngx_cpp_test_module 

  --add-module=PATH                  enable external module #啟用外部模組支援 
  --add-dynamic-module=PATH          enable dynamic external module 
#編譯相關的引數 
  --with-cc=PATH                    set C compiler pathname #如果想設定一個不在預設path下的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 

  --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 #為指定的CPU使用zlib彙編源進行優化 

  --with-libatomic                  force libatomic_ops library usage # 為原子記憶體的更新操作的實現提供一個架構 
  --with-libatomic=DIR              set path to libatomic_ops library sources #指向libatomic_ops安裝目錄 

  --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日誌

相關推薦

centOS7環境nginxTCP負載均衡

七. 編譯原始碼  先使用./configure –help 檢視編譯幫助:  我的線上編譯引數,預設開啟的不用寫  ./configure --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_s

Nginx JavaWeb負載均衡

alt ram php 應用 編譯 ice end 不同 roo 隨著用戶量的增大,單臺服務器已經滿足不了用戶的需求。 準備工作:安裝 gcc、pcre-devel、zlib、OpenSSL 一下是在線 離線請戳這裏 gcc 安裝安裝 nginx 需要先將官網下載的源碼

Centos7.4 Nginx反向代理+負載均衡配置

cti war RM image rom 使用 CA 二級域名 orm Ningx是一款高性能的HTTP和反向代理服務器,配置起來也比較簡單。 測試環境:   172.16.65.190  Nginx-反向代理   172.16.65.191  Ningx-Web   17

nginx配置tcp負載均衡

nginx負載tcp服務和http負載的方式很類似,但是會出現超時丟失連線的問題,所以要設定他的超時時間: stream{ upstream myServer{ server 192.168

centos7安裝nginx及簡單負載均衡配置

準備環境:centos7伺服器(1). 安裝epel 源    更新源:yum update epel-release        安裝epel源:yum install epel-release -y (2). 安裝nginx    安裝nginx: yum instal

nginx+tomcat實現負載均衡以及session共享(linux centos7環境)

processes 解壓 smo eve cti 下載 gen cli -c 一、nginx的安裝 1.準備三份tomcat tomcat1 設置端口 8080 tomcat2 設置端口 8081 tomcat3 設置端口 8082 2. 下載nginx 3. 解壓到/ho

centOS7安裝nginx負載均衡

我的機器資訊: 系統版本: [[email protected] ~]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:d

Docker教程三之基於Centos7Nginx環境映象以及簡單負載均衡

上一章我完成了NodeJs映象,NodeJs跑起了服務,那麼這章,我們繼續對該服務進行建立負載的Nginx映象因為負載均衡需要單獨的伺服器,當然,一個伺服器也可以,但是就失去了多伺服器的意義,所以,我還是決定單獨建立一個基於CentOS 7 的 Nginx 環境映象我只需要對

使用nginx tcp/udp 負載均衡

  目標:對非http流量進行負載均衡 可選技術:nginx + docker-compose ,,,, 過程: 負載tcp/udp流量需要重新構建一下nginx,官網原文是 built with the --with-stream ,於是找了幾個帶引數的Docker

centos7系統下配置nginx php-fpm負載均衡

  三臺Centos7伺服器 主:192.168.199.174 從:192.168.199.170 從:192.168.199.191 均全新最小化安裝,都關閉了防火牆和SELINUX 第一步 先在 主伺服器 上安裝Nginx,可以在改配置前直接開啟服務訪問看看有沒有

nginx+php負載均衡叢集環境中的session共享方案梳理

在網站使用nginx+php做負載均衡情況下,同一個IP訪問同一個頁面會被分配到不同的伺服器上,如果session不同步的話,就會出現很多問題,比如說最常見的登入狀態。 下面羅列幾種nginx負載均衡中session同步的方式 1)不使用session,換用cookiesession是存放在伺服器端的,c

centos7下配置nginx反向代理負載均衡叢集

一,實驗介紹利用三臺centos7虛擬機器搭建簡單的nginx反向代理負載叢集,三臺虛擬機器地址及功能介紹192.168.1.188    nginx負載均衡器192.168.1.189    web01伺服器192.168.1.190    web02伺服器軟體準備:   

Windows+Nginx+Tomcat搭建負載均衡和叢集環境同時實現session共享(一)

摘要:隨著網站的訪問量越來越多,所以就考慮給網站增加伺服器了,現在比較流行的做法就是給網站做叢集環境,下面我把我做的過程記錄一下,方便日後檢視,同時也希望可以幫助到有需要的朋友! 一:首先是環境: 1.jdk 1.6.0_45 2.tomcat 6.0.44 3.nginx

Windows環境下實現Nginx+2tomcat實現負載均衡

在專案運營時,我們都會遇到一個問題,專案需要更新時,我們可能需先暫時關閉下伺服器來更新。但這可能會出現一些狀況: 1.使用者還在操作,被強迫終止了(我們可以看日誌等沒人操作的時候更新,但總可能會

nginx反向代理+負載均衡

-- lib 安裝環境 vim dev usr 代理服務 png 安裝nginx 關閉防火墻 檢查zlib-devel pcre-devel是否安裝 源碼編譯安裝Nginx ./configure --prefix=/usr/local/nginx make &&a

nginx四層負載均衡配置

mysql nginx四層負載均衡配置 客戶端 配置文件 stream nginx四層負載均衡配置代理Mysql集群環境如下:ip 192.168.6.203 Nginxip 192.168.6.*(多臺) Mysql步驟一查看Nginx是否安裝stream模塊沒安裝則進行安裝 操作步驟如

nginxnginx + tomcat + redis 負載均衡且session一致性

權限 gzip 通過 del 跳轉 home val zhang ctp 說明: 本文描述的是 nginx + tomcat + redis 實現應用負載均衡且滿足session一致性,從安裝到配置的全部過程,供大家學習!nginx 代理服務器ip: 10.219.24.2

nginx反向代理負載均衡

nginx 負載均衡1.反向代理概述反向代理(Reverse Proxy)方式是指以代理服務器來接受internet上的連接請求,然後將請求轉發給內部網絡上的服務器,並將從服務器上得到的結果返回給internet上請求連接的客戶端,此時代理服務器對外就表現為一個反向代理服務器。環境準備:主機名IP地址角色系統

Nginx/LVS/HAProxy負載均衡軟件的優缺點詳解

pro 做到 提交 處理 流行 pin 測試 技術分享 一是 參考鏈接:http://www.ha97.com/5646.html (總結)Nginx/LVS/HAProxy負載均衡軟件的優缺點詳解 PS:Nginx/LVS/HAProxy是目前使用最廣泛的三種負載均衡軟件

Nginx+Tomcat簡單負載均衡

啟動 /usr nbsp webapp server XML img 9.png 測試 Nginx,Apache安裝完成 復制一份copy,變兩個Tomcat apache-tomcat-9.0.0.M26-a apache-tomcat-9.0.0.M26-b