Such a scenario, we have a server, but want to hang multiple sites, then Apache configuration virtual host can meet this demand;
It is simpler to configure the following configuration steps based on the host name:
Sample Environment
ip:115.28.17.191
Domain Name: baijunyao.com
Thinkbjy.com
Directory/var/www/html/baijunyao
/var/www/html/thinkbjy
1: Modify the Hosts file
[Root@iz28qa8jt4uz/]# ifconfig; View IP and record your own IP address
[Root@iz28qa8jt4uz/]# vim/etc/hosts; Modify the Hosts file to add the following two lines of content
115.28.17.191 baijunyao.com
115.28.17.191 anlianma.com
2: Modify the httpd.conf file
[Root@iz28qa8jt4uz/]# vim/etc/httpd/conf/httpd.conf; Modify httpd.conf File Delete 990 lines namevirtualhost *:80 before # comment
3: Modify the httpd-vhosts.conf file
[root@iz28qa8jt4uz/]# vim/etc/httpd/conf.d/virtual.conf; //settings httpd-vhosts.conf as follows if no new
<virtualhost *:80>
Documentroot/var/www/html/baijunyao
ServerName baijunyao.com
</VirtualHost>
<virtualhost *:80>
Documentroot/var/www/html/anlianma
ServerName anlianma.com
</VirtualHost>
This concludes the virtual host configuration and creates a new HTML page test in the corresponding directory;
If you need to mount multiple sites at the same time in a local wamp environment please refer to: Set up a local wamp environment to mount multiple sites to run simultaneously
This article for Bai Jun Remote original article, reproduced without contact with me, but please specify from Bai Jun remote blog baijunyao.com