這些軟件包如果yum上沒有的話可以下載源碼來編譯安裝,只是要注意編譯時默認安裝的目錄,確保下面在安裝nginx時能夠找到這些動態庫文件(ldconfig)。
從 http://nginx.org/en/download.html 下載穩定版nginx-1.6.3.tar.gz到/usr/local/src下解壓。
為了后續準備我們另外下載2個插件模塊:nginx_upstream_check_module-0.3.0.tar.gz —— 檢查后端服務器的狀態,nginx-goodies-nginx-sticky-module-ng-bd312d586752.tar.gz(建議在/usr/local/src下解壓后將目錄重命名為nginx-sticky-module-ng-1.2.5) —— 后端做負載均衡解決session sticky問題(與upstream_check模塊結合使用需要另外打補丁,請參考nginx負載均衡配置實戰)。
請注意插件與nginx的版本兼容問題,一般插件越新越好,nginx不用追新,穩定第一。nginx-1.4.7,nginx-sticky-module-1.1,nginx_upstream_check_module-0.2.0,這個搭配也沒問題。sticky-1.1與nginx-1.6版本由于更新沒跟上編譯出錯。(可以直接使用Tengine,默認就包括了這些模塊)
[root@cachets nginx-1.6.3]# pwd
/usr/local/src/nginx-1.6.3
[root@cachets nginx-1.6.3]# ./configure --prefix=/usr/local/nginx-1.6 --with-pcre /
> --with-http_stub_status_module --with-http_ssl_module /
> --with-http_gzip_static_module --with-http_realip_module /
> --add-module=../nginx_upstream_check_module-0.3.0
[root@cachets nginx-1.6.3]# make && make install