touchmm 发表于 2013-1-29 21:56:21

用nginx做weblogic的前端负载均衡器

## set uid and gid of processuser webproxy ngboss;## how many process will be startedworker_processes 10;## worker_cpu_affinity defineworker_cpu_affinity 000000000100 000000001000 000000010000 000000100000 000001000000 000010000000 000100000000 001000000000 010000000000 100000000000;## how many open files will be allowd of each processworker_rlimit_nofile 51200; ## error log definderror_loglogs/error.log crit;## save master process-id in filepid      logs/nginx.pid;events {## powered by epoll, good!use epoll;worker_connections 51200; }http {include       mime.types;default_typetext/html;## access log format defindlog_formatmain'$remote_addr [$time_local] $request $status $body_bytes_sent';## access log defindaccess_loglogs/access.logmain;## fast send file system call, good!sendfileon;tcp_nopushon;tcp_nodelayon;client_body_buffer_size 1024k;proxy_connect_timeout600;proxy_read_timeout600;proxy_send_timeout600;proxy_buffer_size8k;proxy_buffers4 32k;proxy_busy_buffers_size64k;proxy_temp_file_write_size1024k;## set connection timeout (by second)keepalive_timeout30;## gzip setting begin.gzipon;gzip_min_length1k;gzip_buffers4 16k;gzip_http_version1.1;gzip_comp_level9;gzip_varyoff;gzip_typestext/plain text/javascript text/css text/xml application/xml;## gzip setting end.output_buffers4 32k;postpone_output1460;client_header_buffer_size128k;large_client_header_buffers4 256k;## default encoding      # charset GBK;## app redirect && load-balancer start# ngboss clusterupstream ngboss_cluster {ip_hash;server 10.238.15.65:7101;server 10.238.15.66:7201;server 10.238.15.67:7301;server 10.238.15.68:7401;}# saleserv clusterupstream saleserv_cluster {ip_hash;server 10.238.15.65:8181;server 10.238.15.66:8281;server 10.238.15.67:8381;server 10.238.15.68:8481;server 10.238.15.65:8182;server 10.238.15.66:8282;server 10.238.15.67:8382;server 10.238.15.68:8482;}# acctmanm clusterupstream acctmanm_cluster {ip_hash;server 10.238.15.65:8191;server 10.238.15.66:8291;server 10.238.15.67:8391;server 10.238.15.68:8491;server 10.238.15.65:8192;server 10.238.15.66:8292;server 10.238.15.67:8392;server 10.238.15.68:8492;}# custmanm clusterupstream custmanm_cluster {ip_hash;server 10.238.15.65:8111;server 10.238.15.66:8211;}# groupserv clusterupstream groupserv_cluster {ip_hash;server 10.238.15.65:8183;server 10.238.15.66:8283;}# salemanm clusterupstream salemanm_cluster {ip_hash;server 10.238.15.65:8121;server 10.238.15.66:8221;}# chnlmanm clusterupstream chnlmanm_cluster {ip_hash;server 10.238.15.65:8101;server 10.238.15.66:8201;}# resmanm clusterupstream resmanm_cluster {ip_hash;server 10.238.15.65:8131;server 10.238.15.66:8231;}# prodmcrm prodmbil bilmanm clusterupstream prodmanm_cluster {server 10.238.15.66:8261;}# copmanm clusterupstream copmanm_cluster {server 10.238.15.66:8271;}# sysmanm clusterupstream sysmanm_cluster {ip_hash;server 10.238.15.65:8141;server 10.238.15.66:8241;}# statmanm clusterupstream statmanm_cluster {ip_hash;server 10.238.15.65:8151;server 10.238.15.66:8251;}## app redirect && load-balancer endserver {listen       10.238.15.101:18080;server_name10.238.15.101;proxy_set_header   X-Forwarded-For$remote_addr;                # charset GBK;location /download {root html;proxy_redirect off;}location /saleserv {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://saleserv_cluster;                              expires max;                              break;                        }proxy_passhttp://saleserv_cluster;proxy_redirectoff;}location /acctmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://acctmanm_cluster;                              expires max;                              break;                        }proxy_passhttp://acctmanm_cluster;proxy_redirectoff;}location /custmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://custmanm_cluster;                              expires max;                              break;                        }proxy_passhttp://custmanm_cluster;proxy_redirectoff;}location /groupserv {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://groupserv_cluster;                              expires max;                              break;                        }proxy_passhttp://groupserv_cluster;proxy_redirectoff;}location /salemanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://salemanm_cluster;                              expires max;                              break;                        }proxy_passhttp://salemanm_cluster;proxy_redirectoff;}location /chnlmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://chnlmanm_cluster;                              expires max;                              break;                        }proxy_passhttp://chnlmanm_cluster;proxy_redirectoff;}location /resmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://resmanm_cluster;                              expires max;                              break;                        }proxy_passhttp://resmanm_cluster;proxy_redirectoff;}location /prodmcrm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://prodmanm_cluster;                              expires max;                              break;                        }proxy_passhttp://prodmanm_cluster;proxy_redirectoff;}location /prodmbil {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://prodmanm_cluster;                              expires max;                              break;                        }proxy_passhttp://prodmanm_cluster;proxy_redirectoff;}location /bilmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://prodmanm_cluster;                              expires max;                              break;                        } proxy_passhttp://prodmanm_cluster;proxy_redirectoff;}location /copmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://copmanm_cluster;                              expires max;                              break;                        } proxy_passhttp://copmanm_cluster;proxy_redirectoff;}location /sysmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://sysmanm_cluster;                              expires max;                              break;                        } proxy_passhttp://sysmanm_cluster;proxy_redirectoff;}location /statmanm {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://statmanm_cluster;                              expires max;                              break;                        } proxy_passhttp://statmanm_cluster;proxy_redirectoff;}location /nginxstatus {stub_status on;access_log off;allow all;}location / {                        if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$") {                              proxy_pass http://ngboss_cluster;                              expires max;                              break;                        } proxy_passhttp://ngboss_cluster;proxy_redirectoff;}# redirect server error pages to the static page /50x.htmlerror_page 500 502 503 504/50x.html;location = /50x.html {root   html;}
页: [1]
查看完整版本: 用nginx做weblogic的前端负载均衡器