Answer the question
In order to leave comments, you need to log in
Can a balancer server serve static content?
Hello!
Faced one problem. There are three servers: the most powerful and two of the same.
I configured upstream and it works fine. The "most powerful" server-balancer was:
upstream backend {
least_conn;
server ip1 weight=3; #root - "самый мощный"
server ip2 weight=2; #2
server ip3 weight=1; #3
}
Answer the question
In order to leave comments, you need to log in
Error - bad Google.
The solution is to the devacademy website . The link is cut.
Title: Load balancing for NGINX
Thanks to the author.
The server responsible for load balancing, I call the master, but it can also act as a request handler, like the other two. In this example, it is allowed to use the main server to process requests.
Another scenario: we use a load balancer to process requests. We will apply a little trick. Change the following settings on the server:
upstream balancer {
server 192.168.1.100:80 ;
server 192.168.1.106:80 ;
}
server {
listen 192.168.1.100:80;
server_name yoursite.com;
error_log /var/log/yoursite.com-error.log;
location / {
proxy_pass http://balancer;
}
}
server {
access_log off;
error_log /var/log/yoursite.com-error.log;
listen 127.0.01:80;
server_name yoursite.com www.yoursite.com;
location ~* .(gif|jpg|jpeg|png|ico|wmv|3gp|avi|mpg|mpeg|mp4|flv|mp3|mid|js|css|wml|swf)$ {
root /var/www/yoursite.com;
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location / {
root /var/www/yoursite.com;
index index.php index.html index.htm;
}
}
upstream balancer {
server 192.168.1.100:80 ;
server 192.168.1.106:80 ;
server 127.0.0.1:80 ;
}
server {
listen 192.168.1.100:80;
server_name yoursite.com;
error_log /var/log/yoursite.com-error.log;
location / {
proxy_pass http://balancer;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question