Configure the Apache Virtual Host and wampapache In the wamp Development Environment
Website ConstructionWhen people perform local tests, they are often not a website. How can they enter a "Domain Name" in the address bar just like a domain name to access the website locally? Here we needApache Virtual Host configured!
1. Find the apache \ conf \ httpd. conf file and find the code # Include conf/extra/httpd-vhosts.conf in the file to delete the previous!
2, find the apache \ conf \ extra \ httpd-vhosts.conf file, we need to configure the virtual machine in this file! Open this file and you can delete all the # items in front of the Code. They only serve as comments, and they seem to be in the way!
3. The following describes the functions of each code,
NameVirtualHost is the virtual machine port number. You do not need to change it unless you change the original wamp port number!
ServerAdmin email address
DocumentRoot: The main directory of the VM.
ServerName: The Virtual Machine domain name.
ServerAlias the alias of the Virtual Machine Domain Name
ErrorLog storage location of the VM Error Log
CustomLog storage location of the VM access log
CustomLog is followed by a common log format, and
Referer records visitor source information
The agent records the version of the agent software.
Combined combination of three types
Note that the configurations of each virtual machine are in the VirtualHost label of each virtual machine.
The following is an example
4. When you configure a virtual machine in the httpd-vhosts.conf file, you need to change it to the Directory of your virtual machine in httpd. conf, and add Directory labels as many virtual machines as possible.
The following is an example
5. When you access a website using the domain name defined in the virtual machine, you will find that the website is still inaccessible. Why? Our last step is to resolve our domain name to an IP address through the dns server.
First, open the C: \ Windows \ System32 \ drivers \ etc \ hosts file locally. Note that you do not need to open the file as an administrator. You will find the following code
This is the IP address that your original localhost was resolved. Now it's easy. Just follow it and resolve your domain name to 127.0.0.1!
Then, you need to refresh the dns resolution cache and start-> Run-> cmd
Enter ipconfig/flushdns and click the Enter key. The following figure is displayed, indicating that the operation is successful!
Now, you can access your website by entering your domain name!
Wamp basic configurationEnter
Configure the wamp Development Environment
This article is original to Wang yelou's personal blog. If you want to reprint it, please indicate the source:Wang yelou's blog www.ly89.cn