原创 ngx_http_rewrite_module模塊

The ngx_http_rewrite_module module is used tochange request URI using PCRE regular expressions,return redirects, and con

原创 ngx_http_fastcgi_module模塊

該模塊轉發請求到FastCGI服務器,不支持php模塊方式1、fastcgi_pass address;(Context:location, if in location)    address爲後端的fastcgi server的地址2、

原创 ngx_http_core_module模塊

一、與套接字相關的配置:1、server {...} 配置一個虛擬主機   server {     listen address[:PORT]|PORT;     server_name SERVER_NAME;     root /PA

原创 inode總結

什麼是inode?    理解inode,要從文件儲存說起。文件儲存在硬盤上,硬盤的最小存儲單位叫扇區(Sector)。每個扇區儲存512字節(相當於0.5KB)。操作系統讀取硬盤的時候,不會一個個扇區地讀取,這樣效率太低,而是一次性連續讀

原创 ngx_http_ssl_module模塊

1、ssl on | off;    爲指定虛擬機啓用HTTPS protocol, 建議用listen指令代替2、ssl_certificate file;    當前虛擬主機使用PEM格式的證書文件3、ssl_certificate_k

原创 LVS-NAT模型

LVS-NAT集羣環境實現同步集羣環境所有服務器的時間:(時間必須同步,注意防火牆和SELinux狀態)    LVS服務器配置:        安裝包chrony            修改配置文件vim /etc/chrony.conf

原创 ngx_http_referer_module模塊

該模塊用來阻止Referer首部無有效值的請求訪問,可防止盜鏈1、 valid_referers none|blocked|server_names|string ...;    定義referer首部的合法可用值,不能匹配的將是非法值no

原创 LVS-DR模型實現調度

LVS-DR集羣環境實現(LVS服務器的網關可以任意配置,只要能出本地接口就行)    實驗環境:(5臺主機)        一臺客戶端        一臺路由器        一臺LVS服務器        兩臺RS服務器1、搭建網絡環境

原创 ngx_http_upstream_module模塊

用於將多個服務器定義成服務器組,而由proxy_pass,fastcgi_pass等指令進行引用1、upstream name { ... }(Context: http)    定義後端服務器組,會引入一個新的上下文,默認調度算法是wrr

原创 Keepalived主主模型

1、確保確保iptables及selinux不會成爲阻礙。保持集羣時間同步2、在ka1上    vim /etc/keepalived/keepalived.confglobal_defs {    notification_email {

原创 ldirectord+LVS實現高可用

ldirectord+LVS    安裝包        ldirectord-3.9.6-0rc1.1.2.x86_64.rpm    配置        每端口持久(PPC)            cp /usr/share/doc/l

原创 Keepalived主備切換時執行腳本

定義通知腳本:notify_master <STRING>|<QUOTED-STRING>:當前節點成爲主節點時觸發的腳本notify_backup <STRING>|<QUOTED-STRING>:當前節點轉爲備節點時觸發的腳本notif

原创 ngx_http_gzip_module模塊

1、gzip on | off;    啓用或禁用gzip壓縮2、gzip_comp_level level;    壓縮比由低到高:1 到 9 ,默認:13、gzip_disable regex ...;    匹配到客戶端瀏覽器不執行壓

原创 Keepalived單主模式

1、配置selinux ,iptables ,同步時間各節點時間必須同步:            ntpdate TIME_SERVER_IP (如果沒有ntpdate,安裝ntp包,或者直接安裝ntpdate包)            v

原创 ngx_http_proxy_module模塊

1、proxy_pass URL;Context:location, if in location, limit_except注意:proxy_pass後面路徑不帶uri時,會將location的uri傳遞(附加)給後端主機server {