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