When we debug PHP projects, we always run PHP projects through the http://localhost/127.0.0.1+ directory in the browser's address bar; but when we have multiple files in the same site root directory, When working on a project, it is very troublesome to debug through the http://localhost/127.0.0.1+ directory.
If you can configure a corresponding domain name for each project, it will be much more convenient to access the corresponding project through this domain name.
Next we will try to configure the domain name of the corresponding project.
Development environment:
windows (64-bit) + wampserver integrated environment
Configuring domain name steps:
1. Open hosts in the computer operating system directory File;
C:\Windows\System32\drivers\etc\hosts
Add domain name:
127.0.0.1 kuaican.com
2. Open wamp's Apache configuration file httpd.conf,
httpd.conf path: E:\wamp\bin\apache\Apache2.2.21\conf\httpd.conf
Open the file httpd.conf file , search for Include conf/extra/httpd-vhosts.conf
and remove the # in front of it, and then save the file
3. Open E:\wamp\bin\apache\Apache2.2.21 \conf\extra\httpd-vhosts.conf file, add the domain name mapping item, usually at the end of the file:
<VirtualHost *:80> ServerAdmin 995222133@qq.com DocumentRoot "E:/wamp/www/FastFoodShop" ServerName kuaican.com ServerAlias kuaican.com ErrorLog "logs/www.bzzxcs.com -errlo.log" CustomLog "logs/ www.bzzxcs.com -access.log" common </VirtualHost>
4. After saving, restart wamp, and now use the kuaican.com domain name just configured You can access the corresponding project;
Rendering:
Related recommendations:
Configuring the domain name on wamp
Configuring virtual host in WampServer3 environment
wampserver path configuration problem
The above is the detailed content of How to configure domain name in wampserver. For more information, please follow other related articles on the PHP Chinese website!