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.
For example, request two URLs:
1), Www.000.com/sale
2),www.000.com/matchmaker
#user nobody;worker_processes 1;events { worker_connections 1024;} HTTP { include mime.types; Default_type Application/octet-stream; Sendfile on ; Keepalive_timeout ; Upstream Sale { server 192.168.1.100:8000 max_fails=2; } Upstream Matchmaker { server 192.168.1.200:8080 max_fails=2; } server { listen ; server_name www.000.com; Location/sale { root/www proxy_pass http://sale; } Location/matchmaker { root/www proxy_pass http://matchmaker; } }}
Description
When the request HTTP/www.000.com/sale arrives, the domain name of the listening port 80 port is www.000.com based on location 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
The above describes the use of Nginx for the URL to achieve load balancing or interface directed distribution, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.