Using domain-based virtual host configuration is a popular way to configure multiple domain names on the same IP and access through 80 ports.
(1) Configure 192.168.1.215 This address on the fifth interface of the NIC Eth0:
(2) Configure the/etc/hosts file, the 192.168.1.215 corresponding domain name is as follows:
Do a ping test to ensure that the IP is on-pass:
(3) Establish a virtual host to store the root directory of the Web page, and create the index.html file of the homepage file
(4) Modify the/usr/local/apache2/conf/httpd.conf file so that the server starts listen 192.168.1.215:80
(5) Edit the configuration file for each domain name:
Take/usr/local/apache2/conf/vhost/www.name1.com.conf as an example:
192.168. 1.215:> ServerName www.name1.com documentroot /usr/local/apache2/ www/www.name1.com "/usr/local/apache2/www/www.name1.com/"> Options Indexes followsymlinks allowoverride None Require all granted </Directory></VirtualHost>
(6) Check that the configuration is correct and restart the Apache service:
(7) test with the Curl command:
(8) Due to the www.name1.com of the accessories in the virtual machine, www.name2.com, www.name3.com three domain names are not registered, so in the Windows host can not directly use these three domain names for access. However, you can enter the IP address directly to access:
You can see that the default access is www.name1.com
CentOS 7 Operations Management notes (7)----Apache Domain-based virtual host configuration