Wamp Common Environment Configuration
Preface: Wamp often requires a customized configuration when used, and several common configurations are described here.
Customizing the Site Directory
Modify Directory Location
For example, open the httpd.conf file.
Find DocumentRoot (two places) and make the following changes:
#demo为自定义网站目录, the following no longer explains DocumentRoot "F:/demo" <directory "F:/demo" >
Restart the configuration service.
Test: Open Browser, enter localhost/test.php (test.php as new test file in demo directory)
Modify interface Display
Modify the Wampmanager.ini file in the Wamp installation directory:
[Menu.left] ... Type:item; Caption: "www directory"; Action:shellexecute; FileName: "F:/wamp/www"; Glyph:2 replaced by: Type:item; Caption: "Demo directory"; Action:shellexecute; FileName: "F:/demo"; Glyph:2 ...
Then modify the Wampmanager.tpl file in the Wamp installation directory:
[Menu.left] ... Type:item; Caption: "${w_wwwdirectory}"; Action:shellexecute; FileName: "${wwwdir}"; Glyph:2 replaced by: Type:item; Caption: "${demo directory}"; Action:shellexecute; FileName: "${f:/demo}"; Glyph:2 ...
Restart the configuration service.
Multi-site Configuration
Open the bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf file under the Wamp installation directory. (Virtual directory configuration file)
Add the following code:
Add sites, test01 and test02 directories to place site files <virtualhost *:80> ServerAdmin webmaster@dummy-host2.example.com//e-mail address, Do not write documentroot "f:/demo/test01"//Website file directory ServerName test01.com//hostname errorlog "logs/ Dummy-host2.example.com-error.log "//error log, can not write customlog" logs/dummy-host2.example.com-access.log "common// Daily log, can not write </virtualhost><virtualhost *:80> ServerAdmin webmaster@dummy-host2.example.com//email address, can not write documentroot "f:/demo/test02"//website file directory ServerName test02.com//host name errorlog "Logs/dummy-host2.example.com-error.log"//error log, can not write customlog "logs/ Dummy-host2.example.com-access.log "common//daily log, can not write </VirtualHost>
As above, open the httpd.conf file again and make the following changes:
# virtual Hosts#include conf/extra/httpd-vhosts.conf replaced by # virtual Hostsinclude conf/extra/httpd-vhosts.conf
Some versions do not have to modify the deny from Allallow from 127.0.0.1 to: Allow from All#allow to 127.0.0.1
Restart Service
Open C:\Windows\System32\drivers\etc\hosts, add:
Add site 127.0.0.1 test01.com127.0.0.1 test02.com
Test: Open the browser and enter test01.com and test02.com. (You need to write the test files in both directories beforehand.)
Custom Port Numbers
Apache defaults to port 80, and if it is occupied, you need to modify the port number.
As above, open the httpd.conf file and make the following changes:
Listen 80 replaced by: Listen 8080 (or changed to other unused port numbers)
ServerName localhost:80 replaced by: ServerName localhost:8080 (same as the port number modified above)
Restart the service.
Test: localhost:8080/test.php (the test file built in front, in the demo directory).