Nginx Tomcat load Balancing static file separation

Source: Internet
Author: User
This article mainly explains Nginx as a front-end Web server, tomcat as a back-end application server, all external network requests from Nginx to the intranet tomcat processing, that is, Nginx will request reverse proxy to Tomcat, or nginx+ The load balancing of Tomcat. Nginx version 1.9.12,tomcat version 7.0.4.2

Load-balanced Nginx configuration and static file separation


Upstream Tomcat_cluster {server 127.0.0.1:8080 weight=1 max_fails=2 fail_timeout=30s;server 127.0.0.1:8081 weight=1 Max _fails=2 fail_timeout=30s;} server {    listen;    server_name  www.yddsj.com;    Index index.jsp index.html index.htm;    #发布目录/www/yddsj    root  /www/yddsj;         Location/    {# tomcat_cluster must be the same as upstream's name Proxy_pass http://tomcat_cluster;proxy_next_upstream http_502 http_ 504 Error Timeout Invalid_header;proxy_set_header   remote-host $remote _addr;proxy_set_header   HOST $host; Proxy_set_header   x-real-ip $remote _addr;proxy_set_header   x-forwarded-for $proxy _add_x_forwarded_for; Client_max_body_size   100m; #expires定义用户浏览器缓存的时间为10天expires 10d;    } #配置Nginx动静分离则加入以下的配置location ~* \. (Html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|swf|flv|wma|wmv|asf|mp3|mmf|zip|rar) ${root/www/yddsj;expires 10d;}}

The above describes the Nginx Tomcat load balancing static file separation, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.