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.