Open the httpd.conf file in c:/wamp/apache/conf,
Enter vhosts with ctrl+f in httpd.conf
Find that line and remove the # sign in front of it
The operation is as shown in the picture
Open the main configuration file of the virtual host
httpd-vhosts.conf in c:/wamp/apache/conf/extra
As shown in the picture
Preparations before starting configuration
Open httpd-vhosts.conf
Anything with # in it can be deleted
Just leave these two lines at the end, (
As shown in the picture
Start configuration
NameVirtualHost *:80
Description:
NameVirtualHost // Virtual host configuration based on domain name (meaning: different domain names access different hosts)
There is at leastone space after NameVirtualHost
"*" // refers to all IP addresses of the server.
*:80 // Regarding the port setting, please note that it must be consistent with the port configured by listen in httpd.conf.
NameVirtualHost *:80 // Note that in the main configuration file of the virtual host, this sentence has only one line .
Main configuration section of virtual host:
Description:
VirtualHost space *:80 //Start of the main configuration section of the virtual host
//The main configuration section of the virtual host ends
ServerName space www.sina.com
Description: ServerName //Customized domain name, mainly used for testing the host
DocumentRoot "c:/sina" //The root directory setting of the host (website), note: This directory must exist
DirectoryIndex index.php index.html default.php //The default homepage setting of the host (website), multiple settings can be separated by spaces.
About directory permission settings:
Description: "Website directory" // must be consistent with DocumentRoot.
About permission settings:
Options //About server feature settings, Indexes | None
Indexes // When the default homepage does not exist, it will be displayed in a list
. Order Deny, Allow //Settings about the host access order
Deny //Access Denied
Allow //Allow access
There is a comma between these two words.
Order Deny, Allow //Access permissions are superimposed. The final result of this sentence is to allow all users to access
Order Allow, Deny //Access permissions are superimposed. The final result of this sentence is to deny access to all users
Order Allow , Deny
Allow from IP address //Two lines are superimposed, and ultimately only the specified IP is allowed to access
Order Deny, Allow
Deny from IP address //Two lines are superimposed, and ultimately only the specified IP access is denied
As shown in the picture
The difference betweenindexes and none is as shown in the figure
The final configuration is like this, as shown in the picture
Native DNS resolution:
Open the local DNS file-->Run-->drivers-->etc-->hosts open
Add a self-defined domain name resolution.
Format: IP space Custom domain name
Method 1: 127.0.0.1 www.sina.com //Can only be accessed by yourself
Method 2: Local network card IP address www.sina.com //Externally, others can access
Finally restart apache
Enter www.daima.com and you will see the following results
Baidu cloud addresses of three software
Database
Link: https://pan.baidu.com/s/1pL5139D Password: 56x3
php
Link: https://pan.baidu.com/s/1c2cbHIS Password: uyh9
apache
Link: https://pan.baidu.com/s/1c2MITZa Password: p3da