V
V
VMesser2018-07-22 13:10:24
Apache HTTP Server
VMesser, 2018-07-22 13:10:24

Do all Apache Virtual Hosts need to be copied to Windows hosts?

I have WAMP.
I've noticed that adding a virtual host through the WAMP native tool results in a duplicate entry in httpd-hosts.conf and the Windows hosts file. At the same time, manually adding ServerAlias ​​to the config does not work, as well as changing the ServerName. A similar entry is needed in hosts
1. Do I understand correctly that when a browser requests hostname.com, it first goes to hosts, from there it goes to Apache at the specified 127.0.0.1, which accepts hostname.com and already redirects it to the local directory?
2. Do I understand correctly that any ServerAlias ​​must always be written in hosts as an additional entry?
2. Do I understand correctly that if the host is not in hosts, then the browser then accesses the DNS specified in the Windows settings, and therefore definitely not WAMP?
3. Do I understand correctly that local host resolution, if it is absent in hosts, is only possible if we specify DNS 127.0.0.1 in the Windows settings? Or is the Apache DNS server not intended for this at all, which means that some other intermediate DNS must be installed?
I'm not going to bother so much, I'm interested in the principle.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Ivanov, 2018-07-22
@VMesser

1. Yes
2. If we are talking about local development, then yes.
3. Yes, in that order
4. If you specify 127.0.0.1 in the dns settings, then the browser will access the 53 localhost port, a dns server should work on it. For development, this is superfluous, because. you need to install an additional service. Apache has nothing to do with DNS.

S
Saboteur, 2018-07-22
@saboteur_kiev

A normal DNS client first of all reads hosts, then checks the local cache, then accesses the DNS server.
Accordingly, if you have not registered a domain anywhere, then the DNS client will not find it.
Instead of setting up a whole local DNS server on which to register a fake domain - the cheapest way is to fix the hosts file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question