H
H
HexUserHex2020-07-27 19:37:13
Web servers
HexUserHex, 2020-07-27 19:37:13

A bit about virtual hosts?

Good afternoon,
I want to put my thoughts in order on the topic of virtual hosts and reverse proxies) .. to make sure that I understand everything correctly ... I decided to ask a few questions.

For example, there is a resource that, by dns name, gives me its ip for example 9.9.9.9 (cloudfire and other CDN proxies do not use ... 100%) In general, I try to go through the browser by entering this IP and the server gives me the standard Apache page (the start stub with welcome etc.) BUT if I go to this resource by DNS name, then everything works and I get access to the site I'm looking for...

As I understand it:
On this server, either vhosts or reverse proxy is used, which, depending on my GET (namely, the value of the HOST: site.com parameter in the HTTP packet) request, redirect me to the appropriate site. Ie, when accessing this server by IP, should I always specify the DNS name of the site I need in the HTTP parameter on this server?

Another question... explain to me the difference between vhost and reverse proxy? What exactly is the functional difference between these two technologies?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SKEPTIC, 2020-07-27
@HexUserHex

Yes. virtual hosts.
In theory, it can be used together. Hosts and reverse. For each host, you can reverse a specific site. This is what ddos ​​protection services do.
To get to the site you need to specify it in the http request. Then the web server will give that site.
A reverse proxy is when the server receives requests and sends them to the site instead of you.
UPD 1
yes, HOST. As of http version 1.1, the HOST header is required.
Read the documentation for how it works. If simplified, then:
In the web server config, the admin specifies hosts, each host has its own address and home directory.
You send an http request to ip 177.166.166.166 with HOST=site.com, the web server parses the request and sees what's in the HOST header. It then maps the header value to its virtual host table. If there is such a host in the table, then the server goes to its home directory and gives the necessary html and other files. If there is no such host in the table, then the information is displayed with a stub (i.e. files that are in the home directory of the default host).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question