I
I
Ivan2016-04-05 23:11:14
Highload
Ivan, 2016-04-05 23:11:14

How to distribute the load on several servers, and so that the pictures are loaded only from 1?

How can I organize the following:
There is 1 domain and 2 web servers (apache). It is necessary that the main page opens either on server 1 or on server 2, and all other pages and pictures on server 1.
1. Can this be implemented at the DNS level?
2. If not, then how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2016-04-06
@skapunker

1. No
2. Install a more or less "smart" balancer, for example lighttpd
For example, we have server 1: ip AAAA
server 2: ip BBBB
domain: vasya.ru
Then on server 1 we hang Apache on 127.0.0.1 port 8080
Listen 127.0.0.1 :8080
Install lighttpd, then in lighttpd config:
server.bind = "AAAA" # Attach lighttpd to external IP
# Enable proxy module
server.modules = (
"mod_proxy"
}
$HTTP["host"] =~ "vasya\.ru " {
setenv.add-request-header ( "Host" => "vasya.ru" ) # add HTTP header
proxy.balance = "round-robin"
proxy.server = ( "(?!index\.php)" = >(( "host" => "127.0.0.1", "port" => 8080 ),
( "host" => "BBBB", "port" => 80)),
"\.(gif|jpg|png|ico)$" => (( "host" => "127.0.0.1", "port " => 8080 )),
"" => (( "host" => "127.0.0.1", "port" => 8080 ))
)
}
Something like this. But it is not at all clear why such a perversion is needed.
man here https://redmine.lighttpd.net/projects/1/wiki/Docs_...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question