Using the Aliyun host, run the centos6.4 64-bit system and bind the domain name after installing the lamp environment. The configuration file is as follows:
<virtualhost *:80>documentroot/var/www/htmlservername 120.24.54.xxx</virtualhost><virtualhost *:80 > documentroot/var/www/html/domain1 ServerName domain.com serveralias *.domain.com</ Virtualhost><virtualhost *:80> documentroot/var/www/html/domain2 ServerName domain.com Serveralias *.domain.com</virtualhost>
You can then access the site to the/var/www/html/domain1 directory via www.domain1.com, but the www.domain1.com access is also point/var120.24 . A. XXX Access also points to the DOMAI1 directory, and the configuration file has not moved anywhere else. I want to point to the HTML directory via IP access and point to the corresponding directory through the domain name access.
You have found the answer by viewing the official documentation:
# Ensure that Apache listens on port 80
Listen 80
for Virtual *:<virtualhost *: >/www/example1servername www.example.com# Other directiveshere </virtualhost><virtualhost *:>/www/ Example2servername www.example.org# Other directiveshere </VirtualHost>
Must be turned NameVirtualHost *:80
on, otherwise no matter how many domain names are bound, all will point to the first virtualhost DocumentRoot
CentOS binds multiple domain names