Nginx ロード バランシング + 動的および静的分離

WBOY
リリース: 2016-08-08 09:21:39
オリジナル
1035 人が閲覧しました

user webroot webroot;
worker_processes 2;
worker_rlimit_nofile 102400;
events {
use epoll;
worker_connections 102400;
}
http {
include mime.types;
default_type /octet-stream;
sendfile on;
keepalive_timeout 60;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
client_max_body_size 8m;
tcp_nopush on;
tcp_nolay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
g zip_vary on;
fastcgi_cache_path /service/nginx/fastcgi_cache tables=1:2 key_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_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
アップストリーム zph_web {
サーバー 192.168.1.134:80weight=1 max_fails=2fail_timeout=30s;
サーバー 192.168.1.135:80weight=1 max_fails=2fail_timeout=30s ;
}
##
サーバー {
listen 80;
server_name www.zhoupeihao.com zhoupeihao.com;
root /data/web/www;
インデックスindex.htmlindex.phpindex.htmindex.shtml;
location / {
proxy_next_upstream http_502 http_504 エラー タイムアウト valid_header;
proxy_set_header ホスト $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For x_forwarded_for;
proxy_pass http://zph_web;
有効期限は 1d;
}
location /ngx_status
{
stub_status on;
access_log off;
}
location ~ .*.(php|jsp|cgi)?$
{
proxy_set_header ホスト $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://zph_web;
}
location ~ .*.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root /data/web/www;
有効期限は 7d;
}
}
}

バージョン通知: 本文は博主原文であり、博主によるダウンロードは許可されていません。

以上は Nginx の負荷均衡 + 動的な静的分離を紹介しましたが、側面の内容も含まれており、PHP 教則に関心のある友人の助けになることを望みます。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!