PHPApache: configure the VM 1. find the httpd. conf file under the \ conf directory of Apache, open it, and find the following two lines:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
Remove the # sign in front of him. the modification is as follows:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
It means to enable the virtual host settings file httpd-vhosts.conf, virtual host settings are set under this file, do not change httpd. conf, this is clearer.
2. find the httpd-vhost.conf file under the \ conf \ extra directory of Apache.
When you open it, it contains the following content:
? VM configuration starts
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "E:/wamp/www/ecshop" // root path of the website-the Directory of the VM, that is, the root directory corresponding to the domain name
ServerName "www.baidu.com" // virtual host domain name-the domain name you want
ServerAlias www. dummy-host.localhost
ErrorLog "log/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
Add the following content before each virtual host configuration starts:
// This is the authorized directory of your vm. generally, it is different from DocumentRoot ""? The Directory of the VM, that is, the root directory of the domain name is the same.
Options Indexes FollowSymLinks between Des ExecCGI
AllowOverride All
Order allow, deny
Allow from all
Allow from all-only allow users can access the directory defined above. Otherwise, the Error 503 will be displayed during IE or firefox access, that is, access is prohibited. This is the default setting of Apache. The last line is like this.
Deny from all: Deny all access to the root directory. others cannot access your website,
So if you want other users to access your project, you have to change it
Allow from all
3. find the hosts file under the C: \ WINDOWS \ system32 \ drivers \ etc directory.
Add the following sentence
127.0.0.1 www.baidu.com? This is your domain name. how many virtual hosts do you need to add such records.
========================================================== ========================================================== ======================================
Example
Options Indexes FollowSymLinks Includes ExecCGIAllowOverride AllOrder allow,denyAllow from all
ServerAdmin webmaster@dummy-host2.localhostDocumentRoot E:\wamp\www\ecshopServerName www.test.comErrorLog logs/dummy-host2.localhost-error_logCustomLog logs/dummy-host2.localhost-access_log common