Nginx 로드 밸런싱 + 동적 및 정적 분리

WBOY
풀어 주다: 2016-08-08 09:21:39
원래의
1033명이 탐색했습니다.

user webroot webroot;
worker_processes  2;
worker_rlimit_nofile 102400;
이벤트 {
    epoll 사용;
    Worker_connections  102400;
}
http {
    include       mime. 유형;
    default_type  application/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= 20초;
        open_file_cache_valid 30s;
        open_file_cache_min_uses 1;
        client_max_body_size 8m;
        tcp_nopush     on;
        t cp_nodelay 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;
        gzip_vary on;
       fastcgi_cache_path /service/nginx/fastcgi_cache 레벨= 1:2key_z 비활성=5m max_size=1g;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k ;
        fastcgi_buffers 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;
       buffer_size        16k;
        Proxy_buffers            4 64k;
        Proxy_busy_buffers_size 128k;
        Proxy_temp_file_write_size 128k;
업스트림 zph_web {
                서버   192.168.1.134:80 가중치=1 max_fails=2 실패_시간 제한=30s;
                서버   192.168.1.135:80 무게=1 max_fails=2 실패_시간 초과= 30대;
        }
##
    서버 {
        듣기       80;
        server_name  www.zhoupeihao.com zhoupeihao.com;
        root   /data/web/www;
            index  index.html index.php index.ht m 인덱스. shtml;
        위치 / {
        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 $proxy_add_x_forwarded_for;
        Proxy_pass http://zph_web;
        만료      1d;
        }
        위치 /ngx_status
        {
        stub_status on;
       access_log off;
        }
        위치 ~ .*.(php|jsp|cgi)?$
        {
        Proxy_set_header 호스트  $host;
        Proxy_set_header X-Real-IP $remote_addr;
        Proxy_set_header X-Forwarded-For $proxy_add_x_for warded_for;
        Proxy_pass http://zph_web;
        }
        위치 ~ .*.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
        {
        루트 /data/web/www;
        만료        7d;
        }
}
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了Nginx负载均衡+动静分离, 包括了方箹,希望对PHP教程有兴趣的朋友有所帮助。

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!