D
D
Dmitry Belousov2020-12-23 09:08:56
Drupal
Dmitry Belousov, 2020-12-23 09:08:56

How does apache redirect happen?

There is a drupal site on Apache. It is configured so that two sites work on the same config, the second site is almost exactly the same, only different styles and a different domain. And it became interesting how apache / drupal determines where to redirect, that is, the second site is specified in ServerAlias. As I understand it, for starters, the router is configured to which ports to forward when one of the two ips is accessed, but how does this happen next?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2020-12-23
@dreven

you look from the point of view of RFC TCP \ IP
, not taking into account that this RFC was developed 60 years ago and in the world now a crutch on a crutch drives a crutch
From your point of view, a demon can give either to a port or to an IP,
but you forgot about crutches;)
And so the
demon on one port, it listens to your http referrer (in fact, it asks the host of your browser that you logged into),
rummages through its configs, looks for the desired value
and substitutes this config.
This is true for all sites except when it is alone, in which case it works from the "default", that is, something like a trash can, so you can access it both by IP and by any domain name.
The rest of the sites work on the principle
explicitly declared domains in priority, if not, then it works out the default config.
In this simple way, you can hang any number of sites on the same IP and the same port.
Further, the routing of which content to show can be at any stage
proxying in a web server, for example, nginx can have separate locations up to geolocation, and so on.
or apache, the same mod_proxy
in apache can be done through mod_rewrite + cnc of the site, you can generally wind up whatever you want.
in general, further mechanisms may already be different

S
Sand, 2020-12-23
@sand3001

Exactly 2 ip and forwarding to them is done from the router? This is not necessary, because the browser, when requesting the server, among other things, sends the requested URL, which actually gets into Apache, and then Apache looks at its configs for this URL. I think you need to google information about the structure of http requests and responses.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question