Apache- bind to a site multiple domain names

About premise:

  • ServerAdmin: Apache Service Manager notification email address, if there is a real e-mail address can also set this value. 
  • ServerName: is the name of the service, can only fill in a domain name.
  • ServerAlias: servername alias, so that a service can bind multiple domain names, separated by spaces.
  • DocumentRoot: the root directory of the site.
  • DirectoryIndex: Set the default access page, that page.

Old methods are as follows:

<VirtualHost *:80>
      ServerAdmin  [email protected]
      DocumentRoot /www/wwwroot/liudong
      ServerName liudong.top
</VirtualHost>
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /www/wwwroot/liudong ServerName www.liudong.top </VirtualHost>
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /www/wwwroot/liudong ServerName www.love.top </VirtualHost>

The new method is as follows:

<VirtualHost *:80>
      ServerAdmin  [email protected]
      DocumentRoot /www/wwwroot/liudong
      ServerName liudong.top
      ServerAlias  www.liudong.top  www.love.top
      DirectoryIndex index.php
</VirtualHost>

 

https://blog.csdn.net/weixin_33997389/article/details/85902877

Guess you like

Origin www.cnblogs.com/liuhaidon/p/11602040.html