Load balancing based on URLs

Source: Internet
Author: User

This provides only one way to direct the interface for location distribution. The simplest configuration makes it clear that the interface is directed for distribution and is not explained for other configurations. such as requesting two url:1), Www.000.com/sale

2),www.000.com/matchmaker

 
  1. #user nobody;
  2. Worker_processes 1;
  3. Events {
  4. Worker_connections 1024;
  5. }
  6. http {
  7. Include Mime.types;
  8. Default_type Application/octet-stream;
  9. Sendfile on;
  10. Keepalive_timeout 65;
  11. Upstream Sale {
  12. server 192.168.1.100:8000 max_fails=2;
  13. }
  14. Upstream Matchmaker {
  15. Server 192.168.1.200:8080 max_fails=2;
  16. }
  17. Server {
  18. Listen;
  19. server_name www.000.com;
  20. Location/sale {
  21. Root/www
  22. Proxy_pass Http://sale;
  23. }
  24. Location/matchmaker {
  25. Root/www
  26. Proxy_pass Http://matchmaker;
  27. }
  28. }
  29. }



Description: When the request/HTTP/ www.000.comWhen/sale arrives, listen for the domain name on port 80 port www.000.comAccording to the location match to sale, and then according to the field Proxy_pass Http://sale to find the corresponding upstream, then the request will arrive 192.168.1.100:8000 this machine. It's done. Load balancing based on URL directed forwarding

Load balancing based on URLs

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.