CentOS 7 Operations Management notes (7)----Apache Domain-based virtual host configuration

Source: Internet
Author: User

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

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.