记曾经日3亿PV时Nginx负载均衡配置

#user  nobody;
worker_processes  auto;
worker_cpu_affinity auto;

error_log  logs/error.log;

worker_rlimit_nofile 65535;
events {
    use epoll;
    worker_connections  102400;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log off;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  1s;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 4k;


    tcp_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;

    large_client_header_buffers 4 16k;
    client_max_body_size 30m;
    client_body_buffer_size 128k;

    proxy_connect_timeout 1s;
    proxy_read_timeout 300;
    proxy_send_timeout 300;
    proxy_buffer_size 64k;
    proxy_buffers   4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    proxy_ignore_client_abort on;

    upstream  phpserv {
        ip_hash;
        server    172.18.77.250:9000  weight=10 max_fails=0 fail_timeout=1s;
        server    172.18.77.252:9000  weight=10 max_fails=0 fail_timeout=1s;
        server    172.18.77.253:9000  weight=10 max_fails=0 fail_timeout=1s;
        server    172.18.77.255:9000  weight=10 max_fails=0 fail_timeout=1s;
        server    172.18.78.0:9000  weight=3 max_fails=0 fail_timeout=1s;
        server    172.18.78.2:9000  weight=3 max_fails=0 fail_timeout=1s;
        server    172.18.78.3:9000  weight=3 max_fails=0 fail_timeout=1s;
        server    172.18.78.4:9000  weight=3 max_fails=0 fail_timeout=1s;
        keepalive 500;
    }

    server {
        listen       8088;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }

    server {
        listen 442 ssl;
        server_name 127.0.0.1;
        ssl_certificate  m-chinachooses-com.pem;
        ssl_certificate_key m-chinachooses-com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }


        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name cv252.chinachooses.com;
        ssl_certificate  cv252-chinachooses-com.pem;
        ssl_certificate_key cv252-chinachooses-com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name jiuv.biqugeso.com;
        ssl_certificate  jiuv.biqugeso.com.pem;
        ssl_certificate_key jiuv.biqugeso.com.key.pem;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }


        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name cv253.chinachooses.com;
        ssl_certificate  cv253-chinachooses-com.pem;
        ssl_certificate_key cv253-chinachooses-com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name cv.chinachooses.com;
        ssl_certificate  cv-chinachooses-com.pem;
        ssl_certificate_key cv-chinachooses-com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name cv255.chinachooses.com;
        ssl_certificate  cv255-chinachooses-com.pem;
        ssl_certificate_key cv255-chinachooses-com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name c.tongbuchi.com;
        ssl_certificate  c.tongbuchi.com.pem;
        ssl_certificate_key c.tongbuchi.com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name c.syichat.com;
        ssl_certificate  4138473_c.syichat.com.pem;
        ssl_certificate_key 4138473_c.syichat.com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name c.zhangshiyuan.com;
        ssl_certificate  c.zhangshiyuan.com.pem;
        ssl_certificate_key c.zhangshiyuan.com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }

    server {
        listen 442 ssl;
        server_name c.huahongding.com;
        ssl_certificate  c.zhangshiyuan.com.pem;
        ssl_certificate_key c.zhangshiyuan.com.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!3DES:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }

        location /cv {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/;
        }

        location /rqndi {
            add_header Upstream-Server $upstream_addr;
            add_header Upstream-Status $upstream_status;
            proxy_connect_timeout 1s;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Connection "Keep-Alive";
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_pass http://phpserv/yii1.1.16/xmeng/ckpv/hd.php;
        }

        location ~* \.(txt|doc)$ {
            root html;
            deny all;
        }
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值