Build static file separation for NginxTomcat server load balancer

Source: Internet
Author: User
Tags nginx reverse proxy
: This article describes how to set up static file separation for NginxTomcat server load balancer. if you are interested in PHP tutorials, refer to it. This article mainly explains how to use Nginx as the front-end web server and tomcat as the backend application server. all Internet requests are forwarded from nginx to the intranet tomcat for processing, that is, nginx Reverse proxy requests to tomcat, or nginx + tomcat load balancing. Nginx version 1.9.12 and tomcat version 7.0.4.2

Server load balancer nginx configuration and static file separation


Upstream tomcat_cluster {server 127.0.0.1: 8080 weight = 1 max_fails = 2 fail_timeout = 30 s; server 127.0.0.1: 8081 weight = 1 max_fails = 2 fail_timeout = 30 s;} server {listen 80; server_name www.yddsj.com; index. jsp index.html index.htm; # release directory/www/yddsj root/www/yddsj; location/{# tomcat_cluster must be the same as upstream 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 $ scheme; limit 100 m; # expires defines that the cache time of your browser is 10 days expires 10 days;} # add the following configuration location to Configure Nginx static/dynamic separation ~ *\. (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 preceding section describes how to set up static file separation for Nginx Tomcat server load balancer, including some content. if you are interested in the PHP Tutorial.

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.