Create multiple sites under Apache (GO)

Source: Internet
Author: User

A few days ago to watch php100 Video learning php friends asked me how in the Wamp on different directories 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 properly, if you say that you wamp have not been able to run successfully, the following methods are not available.
The first thing to do is to install a second Apache service
First, find the Apache2 htppd.conf file. For example: My Wamp is installed on the G-disk, and mine is the G:\wamp\Apache2\conf directory. Everyone's own is installed in the path of their own, and then no longer repeat the words.
Second, copy htppd.conf, after pasting in conf directory after renaming www2.conf (here www2 is custom, you want to become what name can be. But it is not possible to try Chinese. )
Third, use the editor to open (with what the editor doesn't 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
Listen 8080//8080 is the new Apache service listening port, can be changed to their own to listen to. Example: 8888
ServerName localhost:8080
DocumentRoot "G:/WAMP/WWW2"//WWW2 is the directory of our second website
<directory "G:/WAMP/WWW2" >
Then build a new folder under G:/wamp for WWW2
Four, the next is the installation services,
Method One: Open the G:\wamp\Apache2\bin directory, create a new TXT document, the contents of the document are as follows: (red Word 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" input "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\web2.conf "
Then press ENTER to go.
Then we put an HTML file in WWW2 to do the test, in IE input http://localhost:8080 OK. Service OK

The second thing to do is 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 be)
Ii. major changes (changed 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 directory (&)"; 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 directory (&)"; 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, after the change is complete save, and restart Wamp is OK. The following figure is what I look like after I have 3 services installed on the machine.

Create multiple sites under Apache (GO)

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.