Detailed introduction to common WAMP environment configuration example code 9 (Figure)

Source: Internet
Author: User
Custom configurations are often required when using WAMP. several common configurations are introduced here.


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 ).

The above section details the sample code 9 (figure) for WAMP common environment configuration. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.