How to configure multi-site xampp in Windows environment

Source: Internet
Author: User
Tags require net domain

The Hosts file under window

First find the Hosts file under the C:windowssystem32driversetc directory, this file in the current directory can not be modified, so must be copied out (to the desktop), and then add the end of the file you need the site domain name

For example, the Hosts file, which itself is configured with 127.0.0.1 localhost, is the host IP that represents access, and the latter section is the domain name to be accessed

So if you need to configure a www.111cn.net domain name, just add 127.0.0.1 www.111cn.

Finally, I learned on the Internet under Windows Hosts file its role is ' a number of commonly used Web site domain name and its corresponding IP address to establish a "database", when users in the browser to enter a need to log in to the URL, the system will first automatically find the corresponding IP address from the Hosts file, Once found, the system will immediately open the corresponding Web page, if not found, then the system will be submitted to the DNS domain name resolution server for IP address resolution. ' should be similar to a Key-value key value pairs to resolve the domain name, if you can find the appropriate IP on this computer to access the current IP.

vhost configuration file for Apche

First find Vhost directory D:\xampp\apache\conf\extra, the corresponding installation of XAMPP directory to find, find Vhost file, open will see the following system configuration:

DocumentRoot "D:\xampp\htdocs"
ServerName localhost
ErrorLog "Logs/dummy-host2.example.com-error.log"
Customlog "Logs/dummy-host2.example.com-access.log" common

Options Indexes followsymlinks Includes execcgi
Require all granted
Order Allow,deny
Allow from all
AllowOverride authconfig

If you have seen a lot of configuration files, I believe you can see it at a glance, because we previously configured the hosts under windows of the hosting file of the virtual host domain name for www.test.com so in the Vhost file should be configured like this:

The code is as follows Copy Code
ServerAdmin
DocumentRoot "D:\workspace\php\project\public"
ServerName local.test.com
ErrorLog "Logs/dummy-host.example.com-error.log"
Customlog "Logs/dummy-host.example.com-access.log" common

<directory "D:\workspace\php\project\public" >
Options Indexes followsymlinks Includes execcgi
Require all granted
</Directory>

<ifmodule mod_rewrite.c>

<directory "D:\workspace\php\project" >
Rewriteengine on
Rewriterule ^$ public/[L]
Rewriterule (. *) public/$1 [L]
</Directory>

<directory "D:\workspace\php\project\public" >
Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule ^ (. *) $ index.php?_url=/$1 [qsa,l]
</Directory>
</IfModule>


Perhaps different people's directory directory configuration is not the same, the general system default is placed under the D:\xampp\htdocs, but in order to facilitate the release of a number of different projects, we are generally accustomed to the system default access directory configuration to our working directory, to my example: d:/ workspace/php/under the different project directory.

Finally, if you still can't access it, check the Include conf/extra/httpd-vhosts.conf in the httpd.conf file under XAMPP If the statement is commented out, and if it is commented out, remove the comment statement.

Related Article

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.