Simple Nginx Server Load balancer configuration example

Source: Internet
Author: User

Nginx Simple Server Load balancer configuration example 01 user www; 02 03worker_processes 10; 04 05 # error_log logs/error. log; 06 # error_log logs/error. log notice; 07 # error_log logs/error. log info; 08 09 # pid logs/nginx. pid; 10 11 # maximum file descriptor 12worker_rlimit_nofile 51200; 13 14events15 {16 use epoll; 17 18 worker_connections 51200; 19} 20 21http22 {23 include conf/mime. types; 24 default_type application/octet-stream; 25 26 keepalive_timeout 120; 27 28 tcp_nodelay on; 29 30 upstream www.s135.com {31 server 192.168.1.2: 80; 32 server 192.168.1.3: 80; 33 server 192.168.1.4: 80; 34 server 192.168.1.5: 80; 35} 36 37 upstream blog.s135.com {38 server 192.168.1.7: 8080; 39 server 192.168.1.7: 8081; 40 server 192.168.1.7: 8082; 41} 42 43 server44 {45 listen 80; 46 server_name www.s135.com; 47 48 location/{49 proxy_pass http://www.s135.com; 50 proxy_set_header Host $ host; 51 proxy_set_header X-Real-IP $ remote_addr; 52 proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; 53} 54 55 log_format comment '$ remote_addr-$ remote_user [$ time_local] $ request '56' "$ status" $ body_bytes_sent "$ http_referer" '57' "$ http_user_agent" $ http_x_forwarded_for "'; 58 access_log/data1/logs/www. log www_s135_com; 59} 60 61 server62 {63 listen 80; 64 server_name blog.s135.com; 65 66 location/{67 proxy_pass http://blog.s135.com; 68 proxy_set_header Host $ host; 69 proxy_set_header X-Real-IP $ remote_addr; 70 proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; 71} 72 73 log_format comment '$ remote_addr-$ remote_user [$ time_local] $ request '74' "$ status" $ body_bytes_sent "$ http_referer" '75' "$ http_user_agent" $ http_x_forwarded_for "'; 76 access_log/data1/logs/blog. log blog_s135_com; 77} 78}

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.