Answer the question
In order to leave comments, you need to log in
How Apache virtual hosts work?
I just started to get acquainted with apache + php, I just can’t understand one thing: why does apache continue to work (give site content) when no virtual host is registered in it? And on any port, no matter what we add to ports.conf .
Moreover, it gives the content from the /var/www folder, although the Apache docs say that the DocumentRoot is /usr/local/apache/htdocs by default, but in the installed Apache configs it is not redefined anywhere to /var/www
p.s.
I did not mix up the version of the documentation.
service apache2 restart did not forget to do.
Answer the question
In order to leave comments, you need to log in
Well, Apache is a fool =)
He binds to the port, and he comes up with what he should do next.
The reason for this is that they removed Listen from the virtual host section above. nginx, for example, without at least one server {} it will not take off, because listen can only be specified inside server {} (and if not specified, it will simply assume that listen 80 is written there).
/var/www is specific to your linux distribution. It is overridden in Apache sources during build:
./httpd.spec:1:%define contentdir /var/www
anonscm.debian.org/gitweb/?p=pkg-apache/apache2.gi...
Apache includes all configs located in the /var/www/apache2/
folder. Including such a default.conf, I think you can guess.
Depending on the distribution, it can be located in different subdirectories
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question