使用者webroot webroot;
worker_processes 2;
worker_rlimit_nofile 102400;
events {
使用epoll;
worker_connections 使用epoll;
worker_connections 102400; ime.types;
default_type application/八位元組流;
sendfile on;
keepalive_timeout 60;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
client_header_buffer_size 32k;
_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1,
cli; tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
含 文字/一般應用程式/x-javascript 文字/css 應用程式/xml;
gzip_v ary on;
fastcgi_cache_path /service/nginx/fastcgi_cache fastcgi_cache_path /service/nginx/fastcgi_cachex/fastcgi_cache level=1 :2keys_z inactive= 5m max_size=1g;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buff ers 8 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5 ;
proxy_buffer_size 16k;
proxy_buffers 4 64k; proxy_temp_file_write_size 128k;
上游zph_web {
伺服器192.168.1.135:80 權重=1 max_fails =2 failure_timeout=30s ;
}
##
伺服器{
聽 80; root /data/web/www;
索引.htmlindex.phpindex.htmindex.shtml;
位置/ {
proxy_next_upstream http_502 http_504 錯誤逾時invalid_header;
proxy_set_header 主機$host proxy_set_header X-Forwarded-For $proxy_add_x_ forwarded_for;
proxy_pass http://zph_web;
過期 1d;
1d; }
位置/ngx_status
{
stub_status on;
access_log 鎠. *.(php|jsp|cgi)?$
{
proxy_set_header 主機 $host;
proxy_set_header X-真實 $
proxy_set_header X-真實 $
_真實 $
r; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://zph_web;
}
2p
{
root /data/web/www;
過期 7d;
}
}
}
版權聲明:本文為部落客原創文章,部落客不允許不得轉載。
以上就介紹了Nginx負載平衡+動靜分離,包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。