In Apache domain name-based virtual host configuration, multiple methods can achieve the same purpose. In the configuration process, record the configuration that is considered simple and clear by one person, so as not to forget.
1. When multiple sites are built on a Linux host, a default site is required. In the httpd. conf file, modify and add:
<Virtualhost _ default _: 80>
DocumentRoot/var/www/html
</Virtualhost>
Do not enable the default site.
2. Remove # Before # namevirtualhost *: 80 to enable the VM function.
3. You can add a VM as follows and configure it as required:
<Virtualhost *: 80>
Serveradmin webmaster @ .example.com
DocumentRoot/var/www/ns/
Servername ns.example.com
Errorlog logs/ns.example.com-error_log
Customlog logs/ns.example.com-access_log common
</Virtualhost>
<Virtualhost *: 80>
Serveradmin webmaster@abc.com
DocumentRoot/var/www/phpMyAdmin
Servername www.abc.com
Errorlog logs/www.abc.com-error_log
Customlog logs/www.abc.com-access_log common
</Virtualhost>
Certificate -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
In the c: \ windows \ system32 \ drivers \ etc \ hosts table
127.0.0.1 localhost
127.0.0.1 fading.cn
127.0.0.1 dz6.fading.cn
127.0.0.1 x.fading.cn
Or modify the DNS. Multiple Domain Names direct to the same IP address.
Access path:
Http://fading.cn or localhost
Http://dz6.fading.cn
Http://x.fading.cn
Alias alias:
Alias/dz6/"D:/HTTP/wwwroot/discuz! _ 6.0.0 _ SC _gbk/upload /"
<Directory "D:/HTTP/wwwroot/discuz! _ 6.0.0 _ SC _gbk/upload ">
Options indexes Multiviews
AllowOverride none
Order allow, deny
Allow from all
</Directory>
Alias/X/"D:/HTTP/wwwroot/xspace/upload /"
<Directory "D:/HTTP/wwwroot/xspace/upload">
Options indexes Multiviews
AllowOverride none
Order allow, deny
Allow from all
</Directory>
Must be used for access
Http: // localhost/X/Add/
Http: // localhost/dz6/Add/