Some understandings of Apache's domain-based virtual host

xiaoxiao2021-03-06  94

NamevirtualHost *: 80

ServerAdmin cozo@etang.com

DocumentRoot "C: / Wamp / WWW / TEST_PERL"

Servername www.somain.com

ServerAdmin cozo@etang.com

Documentroot "C: / Wamp / WWW / Stats"

Servername www.apachestats.com

After doing the above virtual host definition, all requests that are sent to .121 will be processed by the virtual host binding the IP (if there are multiple virtual hosts), if there is no unforgettable domain name, use the first virtual host ( This IP is of this. All requests that are sent to. 120 are processed by the virtual host of the binding 120. If you use localhost or 127.0.0.1 to access, all virtual hosts do not meet, you will use the DOCROOT in the global definition.

If there is only one IP address, it is also conforming to the above description.

If the above VirtualHost is bound to *: 80, all requests will find the virtual domain name, and if not, the configuration of the first virtual host is used.

Safety:

If all the website files are stored in a large directory, they should build two subdirectories in this directory, using Directory definitions to let these two subdirectories restrict accessible IP, one is not limited. The base directory can be inherited.

All disclosed websites are placed in the disclosed directory and define a virtual host without defining directory permissions, unless there is special needs (such as CGI authority). All unapproved websites are placed in the restricted directory and define the virtual host.

Finally, a virtual host of an illegal domain name is defined, bind *: 80, placed on the first virtual host position, and place an error page in its directory or the most common directory, which can be found to find the IP of the machine Access to this directory can be reached.

转载请注明原文地址:https://www.9cbs.com/read-104527.html

New Post(0)