WAMP common environment Configuration
WAMP common environment Configuration
Preface:Custom configurations are often required when using WAMP. Several Common configurations are described here.
Customize website directory modification directory location
For example, open the httpd. conf file.
Search for DocumentRoot (two locations) and make the following changes:
# Demo is a custom website directory, and DocumentRoot "f:/demo" is not described below"
Restart the configuration service.
Test: Open the browser and enter localhost/test. php (test. php is the new test file in the demo directory)
Modify page display
Modify the wampmanager. ini file in the wamp installation directory:
[Menu. left]... type: item; Caption: "www directory"; Action: shellexecute; FileName: "F:/wamp/www"; replace Glyph: 2 with: Type: item; Caption: "demo directory"; Action: shellexecute; FileName: "F:/demo"; Glyph: 2 ......
Modify the wampmanager. tpl file in the wamp installation directory:
[Menu. left]... type: item; Caption: "$ {w_wwwDirectory}"; Action: shellexecute; FileName: "$ {wwwDir}"; replace Glyph: 2 with: 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 a site. Put website files in the test01 and test02 directories. ServerAdmin webmaster@dummy-host2.example.com // email address, do not write DocumentRoot "f:/demo/test01" // website file directory ServerName test01.com // host name ErrorLog "logs/dummy-host2.example.com-error.log" // error log, do not write CustomLog "logs/dummy-host2.example.com-access.log" common // daily log, do not write ServerAdmin webmaster@dummy-host2.example.com // email address, do not write DocumentRoot "f:/demo/test02" // website file directory ServerName test02.com // host name ErrorLog "logs/dummy-host2.example.com-error.log" // error log, do not write CustomLog "logs/dummy-host2.example.com-access.log" common // daily log, do not write
As shown above, open the httpd. conf file again and make the following changes:
# Virtual hosts # Include conf/extra/httpd-vhosts.conf Replace with # Virtual hostsInclude conf/extra/httpd-vhosts.conf
// If some versions do not exist, replace Deny from allAllow from 127.0.0.1 with: Allow from all # Allow from 127.0.0.1.
Restart service
Open C: \ Windows \ System32 \ drivers \ etc \ hosts and add:
// Add the 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 file in these two directories in advance)
Custom port number
Apache uses port 80 by default. If it is occupied, You need to modify the port number.
As mentioned above, open the httpd. conf file and make the following changes:
Replace Listen 80 with Listen 8080 (or use another unused port number)
Replace ServerName localhost: 80 with: ServerName localhost: 8080 (consistent with the port number modified above)
Restart the service.
Test: localhost: 8080/test. php (the test file created earlier is in the demo directory ).