Nginx Load Balancer Configuration

Source: Internet
Author: User

Nginx.conf

User www www;worker_processes1; Error_log/home/wwwlogs/Nginx_error.log crit;pid/usr/local/nginx/logs/nginx.pid; #Specifies the value forMaximum file descriptors that can is opened by ThisProcess.worker_rlimit_nofile51200; events {use epoll; Worker_connections51200;        }http {include mime.types; Default_type Application/octet-stream; Server_names_hash_bucket_size -;        Client_header_buffer_size 32k; Large_client_header_buffers432k;        Client_max_body_size 50m;        Sendfile on;        Tcp_nopush on; Keepalive_timeout -;        Tcp_nodelay on; Fastcgi_connect_timeout -; Fastcgi_send_timeout -; Fastcgi_read_timeout -;        Fastcgi_buffer_size 64k; Fastcgi_buffers464k;        Fastcgi_busy_buffers_size 128k;        Fastcgi_temp_file_write_size 256k;        gzip on;        Gzip_min_length 1k; Gzip_buffers416k; Gzip_http_version1.0; Gzip_comp_level2; Gzip_types text/plain Application/x-javascript text/css application/XML;        Gzip_vary on;        #limit_zone crawler $binary _remote_addr 10m; Upstream Webapp.dev {server182.92.165.121:8080; }server {Listen the;        server_name www.dearho.com;        Index index.html index.htm index.php; Root/home/wwwroot; Location/{proxy_next_upstream http_502 http_504 error timeout invalid_header;            Proxy_redirect off;               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_pass http://Webapp.dev; } Location/status {stub_status on;        Access_log off; }}include vhost/*. conf;}



One, load balancing is not nginx unique, famous dingding Apache also have, but performance may not be as nginx.

Second, more than one server to provide services, but the domain name only resolves to the primary server, and the real server IP will not be ping can be obtained, add a certain security.

Third, the IP in the upstream is not necessarily the intranet, the external network IP can also. However, the classic case is that a LAN in an IP exposure network, the domain name directly resolved to this IP. The primary server is then forwarded to the intranet server IP.

Four, a server outage, will not affect the normal operation of the site, Nginx will not forward the request to the down IP

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.