[Nginx]-Load Balancer Configuration

Source: Internet
Author: User

nginx.conf File Contents:

User www www;worker_processes 2;error_log/usr/local/nginx/logs/serror.log crit;pid/usr/local/nginx/logs/nginx. PID; #Specifies the value for maximum file descriptors the can is opened by this process.  Worker_rlimit_nofile 65535;events {use epoll; Worker_connections 65535;} HTTP {include Mime.types;default_type application/octet-stream; #charset gb2312;server_names_hash_bucket_size 128;c Lient_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 8m;sendfile on;tcp_nopush on; Keepalive_timeout 60;tcp_nodelay on;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300; Fastcgi_buffer_size 64k;fastcgi_buffers 4 64k;fastcgi_busy_buffers_size 128k;fastcgi_temp_file_write_size 128k;gzip On;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 2;gzip_types text/plain applicat Ion/x-javascript text/css application/xml;gzip_vary on; #limit_zone crawler $binary _remote_addr 10m;log_format ' $ Remote_addr-$remote _user [$time _local] "$request" "$status $body _bytes_sent" $http _referer "" "$ht Tp_user_agent "" $http _x_forwarded_for "'; include/usr/local/nginx/conf/vhosts/*.conf;}

Contents of the Conf file in the Vhosts directory:

Upstream slave {server xxx.xxx.xxx.xxx max_fails=3 fail_timeout=30s weight=5;server xxx.xxx.xxx.xxx max_fails=3 Fail_ timeout=30s weight=5;} server {Listen80;server_name www. xxx.com, #if ($uri ~* "(/login$|/login.html$|/login/index.html$|/admin/.+|/signup$|/signup/.+$|/signup.html$)") {# return301https://$server _name$request_uri;#}location/{client_max_body_size 200m;proxy_pass http://slave;proxy_ Set_header Host $host;p roxy_set_header x-real-ip $remote _addr;proxy_set_header x-forwarded-for $proxy _add_x_ Forwarded_for;client_body_buffer_size 128k;proxy_connect_timeout 600;proxy_read_timeout 600;proxy_send_timeout 600 ;p roxy_buffer_size 64k;proxy_buffers 4 32k;proxy_busy_buffers_size 64k;proxy_temp_file_write_size 64k;} Location =/50x.html {root html;}} Server{listen 443;ssl On;ssl_certificate/alidata/ssl/server.crt;ssl_certificate_key/alidata/ssl/server.key; server_name www. xxx.com, #if ($uri!~* "(/login$|/login.html$|/login/index.html$|/static/.+|/common/api/.+|/admin/.+|/signup$|/ Signup/.+$|/signup.html$) {#return301http://$server _name$request_uri;#}location/{client_max_body_size 200m;proxy_ Pass Http://slave;proxy_set_header Host $host;p roxy_set_header x-real-ip $remote _addr;proxy_set_header X-forwarded-for $proxy _add_x_forwarded_for;client_body_buffer_size 128k;proxy_connect_timeout 600;proxy_read_ Timeout 600;proxy_send_timeout 600;proxy_buffer_size 64k;proxy_buffers 4 32k;proxy_busy_buffers_size 64k;proxy_temp_ File_write_size 64k;proxy_set_header x-forwarded-proto $scheme;p roxy_redirect off;} Location =/50x.html {root html;}}

  

[Nginx]-Load Balancer Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.