Nginx Load Balancing chapter II, Nginx configuration

Source: Internet
Author: User
Tags log tomcat nginx load balancing

If you do not know how to install Nginx under Linux, please refer to the previous article.

Nginx load Balancing configuration is much simpler than Apache, where load balancing with Nginx will no longer describe the configuration of Tomcat clusters, if there is no understanding of the Tomcat cluster configuration, please refer to the Apache Reverse agent combined with Tomcat cluster to achieve load balancing (c), The Tomcat cluster article is configured. Go to the bottom and start configuring Nginx load Balancing.

Let's take a look at the full configuration of Nginx:

#user nobody;  
      
Worker_processes 1;  
#error_log Logs/error.log;  
#error_log Logs/error.log Notice;  
      
#error_log Logs/error.log Info;  
      
      
#pid Logs/nginx.pid;  
Events {Worker_connections 1024;  
    } http {include mime.types;  
      
    Default_type Application/octet-stream; #log_format Main ' $remote _addr-$remote _user [$time _local] "$request" ' # ' $status $body _bytes_s  
      
    Ent "$http _referer" "$http _user_agent" "$http _x_forwarded_for";  
      
    #access_log Logs/access.log Main;  
    Sendfile on;  
      
    #tcp_nopush on;  
    #keepalive_timeout 0;  
      
    Keepalive_timeout 65;  
          
    #gzip on;  
           Upstream Tom_server {server 172.18.117.113:8090 weight=2;  
    Server 172.18.117.116:8080 weight=3;  
        } server {Listen 80; server_name LocalhoSt  
      
        #charset Koi8-r;  
      
        #access_log Logs/host.access.log Main;  
            Location/{Proxy_pass http://tom_server;  
            #root html;  
        #index index.html index.htm;  
      
        } #error_page 404/404.html;  
        # REDIRECT Server error pages to the static page/50x.html # Error_page 502 503 504/50x.html;  
        Location =/50x.html {root html;  
        # Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ {  
        # Proxy_pass http://127.0.0.1;  # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~  
        \.php$ {# root HTML;  
        # Fastcgi_pass 127.0.0.1:9000;  
        # Fastcgi_index index.php; # Fastcgi_param Script_filename /scripts$fastcgi_script_name;  
        # include Fastcgi_params;  
        #} # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one  
        # #location ~/\.ht {# deny all;  
    #}} # Another virtual host using mix of ip-, name-, and port-based configuration #  
    #server {# Listen 8000;  
    # Listen somename:8080;  
      
    # server_name somename alias Another.alias;  
    # location/{# root HTML;  
    # index index.html index.htm;  
    #} # HTTPS Server # #server {# listen 443 SSL;  
      
    # server_name localhost;  
    # ssl_certificate Cert.pem;  
      
    # Ssl_certificate_key Cert.key;  
    # Ssl_session_cache shared:ssl:1m;  
      
    # ssl_session_timeout 5m; # Ssl_cipherS high:!anull:!  
    MD5;  
      
    # ssl_prefer_server_ciphers on;  
    # location/{# root HTML;  
    # index index.html index.htm; #    }  
    #}  
      
}

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/

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.