I am using the Xmapp lite2016 integration package, the configuration virtual directory tutorial is as follows:
Find httpd-vhosts.conf This file, this file is generally located under the Xampp\apache\conf\extra path, can not be found under the search.
You will see a similar interface:
##Use name-based virtual hosting.###NameVirtualHost *:80##VirtualHost Example:#almost any Apache directive could go into a VirtualHost container.#The first VirtualHost section was used for all requests and that does not#match a # #ServerName or # #ServerAlias in any <VirtualHost> block.##<virtualhost *:80># ServerAdmin [email protected].com# DocumentRoot"/xampp/htdocs/"# ServerName localhost# serveralias localhost127.0.0.1# errorlog"Logs/localhost-error.log"# Customlog"Logs/localhost-access.log"Common#</virtualhost>
Uncomment the virtual machine configuration section directly to get
<virtualhost *:80> ServerAdmin [email protected] documentroot "/xampp/htdocs/baidu" Note: The root directory here is your destination folder ServerName www.baidu.com serveralias www.baidu.com Errorlog "Logs/localhost-error.log" customlog "Logs/localhost-access.log" Common</ Virtualhost>
The above Baidu domain name for your website domain name can, documentroot "/xampp/htdocs/baidu" This directory for your file path, I here is www.baidu.com domain corresponding to the corresponding Baidu folder.
And so on, we can continue to add virtual directories:
<virtualhost *:80>ServerAdmin [email protected].com documentroot"/XAMPP/HTDOCS/TP5"ServerName www. Tp5.com Serveralias www. Tp5.com errorlog"Logs/dummy-host.example.com-error.log"Customlog"Logs/dummy-host.example.com-access.log"Common</virtualhost><virtualhost *:80>ServerAdmin [email protected].com documentroot"/xampp/htdocs/jianqingwang"ServerName www. Qingwang.com errorlog"Logs/www.qingwang.com-error.log"Customlog"Logs/www.qingwang.com-access.log"Common</virtualhost><virtualhost *:80>ServerAdmin [email protected].com documentroot"/xampp/htdocs/bootstrap"ServerName www. Bootstrap.Top Errorlog"Logs/www.bootstrap.cn-error.log"Customlog"Logs/www.bootstrap.cn-access.log"Common</VirtualHost>
Well, each virtual directory corresponding to a website, you a server to achieve the function of N Web site services!
So the question is, what if a website has more than one domain name? Here is a Serveralias parameter is to configure multi-domain name, the configuration of multi-domain is as follows:
<virtualhost *:80> ServerAdmin [email protected] documentroot "/XAMPP/HTDOCS/TP5" ServerName www.tp5.com Serveralias www.tp5. com www.tp6.com www.tp7.com www.tp8.com errorlog "logs/ Dummy-host.example.com-error.log " customlog" Logs/dummy-host.example.com-access.log "Common</VirtualHost >
The above red part is the configuration of multi-domain name, well, the tutorial is here, there are mistakes please point out.
PHP Learning notes: Apache configuration virtual directory, a site using multi-domain Configuration method