Multi-Directory Hanging Web site under Wamp control

Source: Internet
Author: User
Tags phpmyadmin
Image:
A few days ago there is an online watch php100 video learning php friends asked me how in the Wamp on different directories to hang multiple sites, I searched the information on the Internet, I have been pondering the afternoon, now put their own methods published, welcome to correct. Also hope that we have a better way to publish it.
The following methods can be done after the WAMP has been able to run normally, and if you have not been able to successfully run the Wamp, the following methods are not available.
The first thing to do is install a second Apache service
First, find Apache2 htppd.conf files. For example: My Wamp is installed in the G disk, and mine is the G:\wamp\Apache2\conf directory. Everyone's own is where to install their own change path, the following no longer repeat this word.
Second, copy htppd.conf, after pasting in the Conf directory after renaming www2.conf (here www2 is custom, you want to become any name can. But it's not possible to try Chinese. )
Use editor to open (with what editor does not matter, Notepad can) open www2.conf find the following code
Listen 80
ServerName localhost:80
DocumentRoot "G:/wamp/www"
<directory "G:/wamp/www" >
Change to
The Listen 8080//8080 is the new Apache service listening port that can be changed to its own listening. For example: 8888
ServerName localhost:8080
DocumentRoot "G:/WAMP/WWW2"//WWW2 is the directory of our second Web site.
<directory "G:/WAMP/WWW2" >
Then build a new folder under G:/wamp for WWW2
The next step is to install the service,
Method One: Open the G:\wamp\Apache2\bin directory, create a new TXT document, the document reads as follows: (Red character part)
Httpd.exe-k install-n "WWW2"-F "G:\wamp\Apache2\conf\web2.conf"

After saving, change the file name and suffix to Www2.bat, double-click to run it
Method Two: Under Windows click "Start"-"Run" type "cmd" and then enter, open a command prompt
Switch the command prompt to G:\wamp\Apache2\bin
Input
Httpd.exe-k install-n "WWW2"-F "G:\wamp\Apache2\conf\www2.conf"
Then you can press ENTER.
Then we put an HTML file in WWW2 to do the test, in IE input http://localhost:8080 OK. Service is normal

The second thing to do is how to use the Wamp console to control the newly installed service after the service is installed
First, open the Wamp directory, find Wampmanager.ini with the editor open (with what editor does not matter, Notepad can)
Ii. major changes (changed in red)
1
[Services]
Name:wampapache
Name:wampmysqld

[Services]
Name:wampapache
Name:wampmysqld
Name:www2

2
[Startupaction]
Action:service; Service:wampapache; Serviceaction:startresume; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:startresume; Flags:ignoreerrors

[Startupaction]
Action:service; Service:wampapache; Serviceaction:startresume; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:startresume; Flags:ignoreerrors
Action:service; SERVICE:WWW2; Serviceaction:startresume; Flags:ignoreerrors

3
[Menu.left]
Type:separator; Caption: "WAMP5"
Type:item; Caption: "Localhost"; Action:run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/"; Glyph:5
Type:item; Caption: "phpMyAdmin"; Action:run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/phpmyadmin/"; Glyph:5
Type:item; Caption: "www catalogue (&)"; Action:shellexecute; FileName: "G:/wamp/www"; Glyph:5

[Menu.left]
Type:separator; Caption: "WAMP5"
Type:item; Caption: "Localhost"; Action:run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/"; Glyph:5
Type:item; Caption: "localhost:8080"; Action:run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost:8080/"; Glyph:5
Type:item; Caption: "phpMyAdmin"; Action:run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/phpmyadmin/"; Glyph:5
Type:item; Caption: "www catalogue (&)"; Action:shellexecute; FileName: "G:/wamp/www"; Glyph:5
Type:item; Caption: "WWW2 catalogue (&)"; Action:shellexecute; FileName: "G:/WAMP/WWW2"; Glyph:5

4
[Startall]
Action:service; Service:wampapache; Serviceaction:startresume; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:startresume; Flags:ignoreerrors

[Startall]
Action:service; Service:wampapache; Serviceaction:startresume; Flags:ignoreerrors
Action:service; SERVICE:WWW2; Serviceaction:startresume; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:startresume; Flags:ignoreerrors

5
[StopAll]
Action:service; Service:wampapache; Serviceaction:stop; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:stop; Flags:ignoreerrors

[StopAll]
Action:service; Service:wampapache; Serviceaction:stop; Flags:ignoreerrors
Action:service; SERVICE:WWW2; Serviceaction:stop; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:stop; Flags:ignoreerrors

6
[Restartall]
Action:service; Service:wampapache; Serviceaction:stop; Flags:ignoreerrors waituntilterminated
Action:service; Service:wampmysqld; Serviceaction:stop; Flags:ignoreerrors waituntilterminated
Action:service; Service:wampapache; Serviceaction:startresume; Flags:ignoreerrors waituntilterminated
Action:service; Service:wampmysqld; Serviceaction:startresume; Flags:ignoreerrors waituntilterminated

[Restartall]
Action:service; Service:wampapache; Serviceaction:stop; Flags:ignoreerrors waituntilterminated
Action:service; SERVICE:WWW2; Serviceaction:stop; Flags:ignoreerrors waituntilterminated
Action:service; Service:wampmysqld; Serviceaction:stop; Flags:ignoreerrors waituntilterminated
Action:service; Service:wampapache; Serviceaction:startresume; Flags:ignoreerrors waituntilterminated
Action:service; SERVICE:WWW2; Serviceaction:startresume; Flags:ignoreerrors waituntilterminated
Action:service; Service:wampmysqld; Serviceaction:startresume; Flags:ignoreerrors waituntilterminated

7
[Myexit]
Action:service; Service:wampapache; Serviceaction:stop; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:stop; Flags:ignoreerrors
Action:exit

[Myexit]
Action:service; Service:wampapache; Serviceaction:stop; Flags:ignoreerrors
Action:service; SERVICE:WWW2; Serviceaction:stop; Flags:ignoreerrors
Action:service; Service:wampmysqld; Serviceaction:stop; Flags:ignoreerrors
Action:exit

Third, save after the change is complete, and restart Wamp OK. Here's what I look like when I have 3 services on the machine.


I do not say that the use of specific changes is the hope that we can think of their own, want to express the point of view: The best way to learn is to practice

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.