The following Apache HTTPD configuration has been set up to create a virtual host available at www.example.com and www2.example.com:



<VirtualHost *:80>
    ServerName www.example.com
    ServerName www2.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/
    <Directory /srv/www/>
        Require all granted
    </Directory>
</VirtualHost>

Even though Apache HTTPD correctly processed the configuration file, requests to both names are not handled correctly. What should be changed in order to ensure correct operations?

A. The configuration must be split into two VirtualHost sections since each virtual host may only have one name.
B. The port mentioned in opening VirtualHost tag has to be appended to the ServerName declaration's values.
C. Both virtual host names have to be placed as comma separated values in one ServerName declaration.
D. Both virtual host names have to be mentioned in the opening VirtualHost tag.
E. Only one Server name declaration may exist, but additional names can be declared in ServerAlias options.

題解

選項「E」是正確答案。可以使用「ServerAlias」來定義多個伺服器別名,可以在同一個「ServerAlias」中使用空格隔開多個別名,也可以使用多個「ServerAlias」來定義。