Reputation: 51
We have setup nginx server and also trying to do the load balancing with 2 other servers.
The setup is: One main server (proxy server) and other two servers (which serves the request)
We have set of .css, .js and .php files. We want the main server to serve all the static files like, .css, .js and image files and only for the .php request we want forward the request to between the 2 serving servers in a load balanced way.
Plz guide me on how to do this.
Upvotes: 2
Views: 537
Reputation: 27107
You can try specifics in the
location /abcd/admin {
server backend1.example.com
}
Upvotes: 0
Reputation: 15110
upstream backends {
server backend1.example.com;
server backend2.example.com;
}
server {
location / {
# your static configuration
root /path/to/static/files;
}
location ~ \.php$ {
# your proxy configuration
proxy_pass http://backends;
}
}
Documentation is a good start point.
Upvotes: 3