In Linux environment Apache configures multiple virtual hosts to mount multiple sites while running __linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.