Httpd Virtual Host Configuration: Difference between revisions
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
The <tt><VirtualHost></tt> section must contain at minimum a <tt>ServerName</tt> directive to designate what host to serve and a <tt>DocumentRoot</tt> directive to indicate the file system directory that contains the content to server. | The <tt><VirtualHost></tt> section must contain at minimum a <tt>ServerName</tt> directive to designate what host to serve and a <tt>DocumentRoot</tt> directive to indicate the file system directory that contains the content to server. | ||
=Configuration Inheritance= | |||
All directives present in the httpd configuration file above the <tt><VirtualHost></tt> section set up the values used by the "main" server, which responds to any requests that are not handled by a <tt><VirtualHost></tt> definition. These values also provide defaults for any <tt><VirtualHost></tt> containers that defined later in the file. | |||
If any of these directives appear inside a <tt><VirtualHost></tt> container, their values override the "main" defaults. |
Revision as of 04:21, 6 January 2016
Internal
Overview
Virtual hosts can be declared using the <VirtualHost> configuration element. <VirtualHost> encloses a group of directives that apply to only a particular virtual host.
Name-Based Virtual Host Configuration
For each virtual host you want to serve, create a <VirtualHost> section.
The <VirtualHost> section must contain at minimum a ServerName directive to designate what host to serve and a DocumentRoot directive to indicate the file system directory that contains the content to server.
Configuration Inheritance
All directives present in the httpd configuration file above the <VirtualHost> section set up the values used by the "main" server, which responds to any requests that are not handled by a <VirtualHost> definition. These values also provide defaults for any <VirtualHost> containers that defined later in the file.
If any of these directives appear inside a <VirtualHost> container, their values override the "main" defaults.