1、配置httpd.conf
Include conf/extra/httpd-vhosts.conf //去掉#
2、配置 httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /home/www/htdocs/test
<Directory "/home/www/htdocs/test">
RewriteEngine on
Require all granted
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
</Directory>
ServerName xxd.ddd.net
ServerAlias xxd.ddd.net
ErrorLog "logs/web.dd-error.log"
CustomLog "logs/web.dd-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /home/www/htdocs/test1
<Directory "/home/www/htdocs/test1">
RewriteEngine on
Require all granted
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
</Directory>
ServerName xxd1.ddd.net
ServerAlias xxd1.ddd.net
ErrorLog "logs/dns.11-error.log"
CustomLog "logs/dns.11-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /home/www/htdocs/test2
<Directory "/home/www/htdocs/test2">
RewriteEngine on
Require all granted
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
</Directory>
ServerName xxd2.ddd.net
ServerAlias xxd2.ddd.net
ErrorLog "logs/app.xx2-error.log"
CustomLog "logs/app.xx2-access.log" common
</VirtualHost>
3、配置hosts