虚拟主机模板

虚拟主机模板使创建具有相似配置的新虚拟主机变得容易。 每个模板都包含一个模板配置文件,一个映射的侦听器列表以及一个成员虚拟主机列表。 要添加基于模板的虚拟主机,管理员只需将具有唯一的虚拟主机名和域名添加到模板成员列表。 模板映射的侦听器列表中的所有侦听器将自动添加到虚拟主机的映射。 稍后,如果您需要为特定虚拟主机自定义配置,只需“实例化”该成员虚拟主机,然后将自动创建一个独立的虚拟主机配置。 即使在设置自定义虚拟主机时,仍然可以用模板快速建立。

Table of Contents

模板位置

模板名称 | 模板文件 | 映射的侦听器

Member Virtual Hosts

虚拟主机名 | 域名 | 别名 | 成员虚拟主机根目录

模板设置

默认虚拟主机根 | Instantiated VHost Config file | 文件根目标 | 模板中的文件名

模板名称

Description

模板的唯一名称。

模板文件

Description

指定此模板配置文件的路径。 该文件必须位于$SERVER_ROOT/conf/templates/中,且文件名带有“ .conf”。 如果您指定的文件不存在,则在尝试保存模板后,将出现错误,为“CLICK TO CREATE”。 点击该链接将生成一个新的空模板文件。 当您删除模板时,该条目将从您的配置中删除,但实际的模板配置文件不会被删除。

Syntax

path

映射的侦听器

Description

Specifies the names of all listeners that this template maps to. A listener-to-virtual host mapping for this template's member virtual hosts will be added to the listeners specified in this field. This mapping will map listeners to virtual hosts based on the domain names and aliases set in the member virtual hosts' individual configurations.

Syntax

comma-separated list

虚拟主机名

Description

此虚拟主机的唯一名称。 该名称在所有的虚拟主机模板和虚拟主机中不得重复。 在目录路径配置中,此名称可以由变量$VH_NAME引用。

如果还配置了具有相同名称的虚拟主机,则虚拟主机的配置将被忽略。

域名

Description

指定该成员虚拟主机的主域名。 如果留白,将使用成员虚拟主机名, 这应该是符合标准的域名,但是您也可以使用IP地址。 对于不在端口80上的网站,建议附加: 对于包含域名的配置,可以使用变量$VH_DOMAIN来引用此域。

该域名将在以下情况下使用:

  1. 在处理请求时匹配主机标头中的主机名。
  2. 作为诸如FrontPage或AWstats之类的域名配置.
  3. 基于虚拟主机模板配置侦听器到虚拟主机的映射。

Syntax

domain name

别名

Description

指定虚拟主机的备用名称。 所有可能的主机名和IP地址都应添加到此列表中。 名称中允许使用通配符 *?。 为不在端口80上的网站附加:

别名将在以下情况下使用:

  1. 在处理请求时匹配主机标头中的主机名。
  2. 作为诸如FrontPage或AWstats之类的域名配置.
  3. 基于虚拟主机模板配置侦听器到虚拟主机的映射。

Syntax

Comma-separated list of domain names.

成员虚拟主机根目录

Description

指定此虚拟主机的根目录。 如果留空,将使用此模板的默认虚拟主机根目录.

Note: 这不是文档根。 建议将与虚拟主机相关的所有文件(如虚拟主机配置,日志文件,html文件,CGI脚本等)放置在此目录下。 虚拟主机根目录可以以变量$VH_ROOT来引用。

Syntax

path

默认虚拟主机根

Description

指定使用此模板的成员虚拟主机的默认根目录。. Variable $VH_NAME must appear in the path. This will allow each member template to be automatically assigned a separate root directory based on its name.

Syntax

path

Instantiated VHost Config file

Description

Specifies the location of the config file generated when you instantiate a member virtual host. Variable $VH_NAME must appear in the path so each virtual host will have its own file. Must be located under $SERVER_ROOT/conf/vhosts/. This config file will be created only after you move a member vhost out of the template through instantiation.

Syntax

String with $VH_NAME variable and .conf suffix

提示

$VH_NAME/vhconf.conf is recommended for easy management.

文件根目标

Description

Specifies the unique path for each member virtual host's document root. Variable $VH_NAME or $VH_ROOT must appear in the path so each member virtual host will have its own document root.

Syntax

path with $VH_NAME or $VH_ROOT variable

例子

$VH_ROOT/public_html/ or $SERVER_ROOT/$VH_NAME/public_html.

模板中的文件名

Description

Specifies a path for the file to be used for member virtual hosts. Variable $VH_NAME or $VH_ROOT must appear in the path so each member virtual host will have its own file.

Syntax

string