CentOS 7.3 Source installation Apache 2.4.16 Configure domain-based virtual host

Source: Internet
Author: User

Add a configuration at the end of the main configuration file:

[Email protected] ~]# vim/usr/local/apache/conf/httpd.conf

Include conf/vhosts.conf

Create a new vhosts,conf under the Conf directory, configured as follows:

<virtualhost 192.168.10.81:80>
DocumentRoot "/var/www/www.bangbangdj.com"
ServerName www.bangbangdj.com
<directory "/var/www/www.bangbangdj.com" >
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

<virtualhost 192.168.10.81:80>
DocumentRoot "/var/www/www.tp3.vs"
ServerName Www.tp3.vs
<directory "/var/www/www.tp3.vs" >
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

<virtualhost 192.168.10.81:80>
DocumentRoot "/var/www/www.tp5.vs"
ServerName Www.tp5.vs
<directory "/var/www/www.tp5.vs" >
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

<virtualhost 192.168.10.81:80>
DocumentRoot "/var/www/www.tpshop.vs"
ServerName Www.tpshop.vs
<directory "/var/www/www.tpshop.vs" >
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

[[Email protected] ~] #echo BANGBANGDJ >/var/www/www.bangbangdj.com

[Email protected] ~]# echo Www.tp3.vs >/var/www/www.tp3.vs/index.html
[Email protected] ~]# echo Www.tp5.vs >/var/www/www.tp5.vs/index.html
[Email protected] ~]# echo Www.tpshop.vs >/var/www/www.tpshop.vs/index.html

Test:

If there is a problem with the access error

You don't have permission to access/on the This server

Can be modified as follows, try

Options Indexes followsymlinks execcgi

CentOS 7.3 Source installation Apache 2.4.16 Configure domain-based virtual host

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.