Apache. Документация на русском


Директивы Apache
  1    2    3    4    5    6    7    8    9    10    11    12    13    14    15    16    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32    33    34    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68    69    70    71      72      73    74    75    76    77    78    79    80    81    82    83    84    85  
  86    87    88    89    90    91    92  
  93    94    95    96    97    98    99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122    123    124    125    126    127    128    129    130    131    132    133    134    135    136    137    138    139    140    141    142    143    144    145    146    147    148    149    150    151    152    153    154    155    156    157    158    159    160    161    162    163    164    165  
  166    167    168    169    170    171    172    173    174    175    176    177    178    179    180    181    182    183    184    185    186    187    188    189    190    191    192    193    194    195    196    197    198    199    200    201    202    203    204    205    206    207    208    209    210    211    212    213    214    215    216    217    218    219    220    221    222    223    224    225    226    227    228    229    230    231    232    233    234    235    236    237    238    239    240    241    242  

 <         > 
Список директив: Core  |  ModRewrite  |  Lua  |  Proxy  |  SSL

Директива ServerName
RU          EN  

Description:Hostname and port that the server uses to identify itself
Syntax: ServerName [scheme://]domain-name|ip-address[:port]
Context:server config, virtual host
Status:Core
Module:core

The ServerName directive sets the request scheme, hostname and port that the server uses to identify itself.

ServerName is used (possibly in conjunction with ServerAlias ) to uniquely identify a virtual host, when using name-based virtual hosts.

Additionally, this is used when creating self-referential redirection URLs when UseCanonicalName is set to a non-default value.

For example, if the name of the machine hosting the web server is simple.example.com , but the machine also has the DNS alias www.example.com and you wish the web server to be so identified, the following directive should be used:

ServerName www.example.com

The ServerName directive may appear anywhere within the definition of a server. However, each appearance overrides the previous appearance (within that server).

If no ServerName is specified, the server attempts to deduce the client visible hostname by first asking the operating system for the system hostname, and if that fails, performing a reverse lookup on an IP address present on the system.

If no port is specified in the ServerName , then the server will use the port from the incoming request. For optimal reliability and predictability, you should specify an explicit hostname and port using the ServerName directive.

If you are using name-based virtual hosts, the ServerName inside a <VirtualHost> section specifies what hostname must appear in the request's Host: header to match this virtual host.

Sometimes, the server runs behind a device that processes SSL, such as a reverse proxy, load balancer or SSL offload appliance. When this is the case, specify the https:// scheme and the port number to which the clients connect in the ServerName directive to make sure that the server generates the correct self-referential URLs.

See the description of the UseCanonicalName and UseCanonicalPhysicalPort directives for settings which determine whether self-referential URLs (e.g., by the mod_dir module) will refer to the specified port, or to the port number given in the client's request.

Failure to set ServerName to a name that your server can resolve to an IP address will result in a startup warning. httpd will then use whatever hostname it can determine, using the system's hostname command. This will almost never be the hostname you actually want.

httpd: Could not reliably determine the server's fully qualified domain name, using rocinante.local for ServerName

See also

  • Issues Regarding DNS and Apache HTTP Server
  • Apache HTTP Server virtual host documentation
  • UseCanonicalName
  • UseCanonicalPhysicalPort
  • ServerAlias
RU          EN