创建时间:1363090557
修改时间: 1559799549
5669-1559799549244前几天有个网上一起看php100视频学习php的朋友问我怎么在wamp上不同目录挂多个网站,我在网上搜了下资料,自己琢磨了一下午,现在把自己的方法公布出来,欢迎大家指正。也希望大家有更好的办法也公布出来。 0103Arial0103#3333330103#ffffff5763-1559799549245以下方法是在wamp已经能正常运行后才能做的,如果说你wamp都没能成功运行,以下方法是不能用的。 050Arial050#333333050#ffffff1647-1559799549246第一要做的是安装第二个apache服务 020Arial020#333333020#ffffff2329-1559799549247一、找到Apache2的htppd.conf文件.例如:我的wamp是安装在G盘的,我的就是G:\wamp\Apache2\conf目录下.大家自己的是安装在哪里的自己换路径,后面不再重复说这话了。 0100Arial012#3333331222#ff00002246#3333334666#ff00006670#3333337099#ff000099100#3333330100#ffffff4564-1559799549250二、复制htppd.conf,粘贴后在conf目录下后更名www2.conf (这里www2是自定义的,你想变成什么名字都可以。不过没试过中文的可行不。) 078Arial04#333333414#ff00001429#3333332938#ff00003878#333333078#ffffff8440-1559799549253三、用用编辑器打开(用什么编辑器无所谓了,记事本就可以)打开www2.conf 找到如下代码 047Arial047#333333047#ffffff3085-1559799549254Listen 80 010Arial010#333333010#ffffff5633-1559799549254ServerName localhost:80 024Arial024#333333024#ffffff9179-1559799549255DocumentRoot "G:/wamp/www" 027Arial027#333333027#ffffff4255-1559799549255<Directory "G:/wamp/www"> 026Arial026#333333026#ffffff9076-1559799549256更改为 04Arial04#33333304#ffffff7499-1559799549257Listen 8080 //8080是新的apache服务监听的端口,可以自己改成自己想监听的。例如:8888 056Arial011#ff00001156#333333056#ffffff8538-1559799549259ServerName localhost:8080 026Arial025#ff00002526#333333026#ffffff9956-1559799549260DocumentRoot "G:/wamp/www2" //www2是我们第二个网站的目录 046Arial027#ff00002746#333333046#ffffff9099-1559799549261<Directory "G:/wamp/www2"> 027Arial026#ff00002627#333333027#ffffff4173-1559799549262然后在G:/wamp下建一新文件夹为 www2 024Arial023#ff00002324#333333024#ffffff5510-1559799549262四、接下来就是安装服务了, 014Arial014#333333014#ffffff2069-1559799549265方法一:打开G:\wamp\Apache2\bin目录,新建一个txt文档,文档内容如下:(红色字部分) 053Arial06#333333625#ff00002553#333333053#ffffff4776-1559799549271httpd.exe -k install -n "www2" -f "G:\wamp\Apache2\conf\web2.conf" 035courier new3551arial5166courier new6667Arial066#ff00006667#333333067#ffffff6554-15597995492722063-1559799549273保存后,更改文件名字以及后缀为www2.bat,双击运行就可以了 033Arial033#333333033#ffffff9831-1559799549273方法二:windows下面点击“开始”-“运行”输入“cmd”然后回车,打开命令提示符 044Arial044#333333044#ffffff8279-1559799549275把命令提示符切换到G:\wamp\Apache2\bin 029Arial09#333333928#ff00002829#333333029#ffffff7892-1559799549275输入 03Arial02#ff000023#33333303#ffffff9090-1559799549276httpd.exe -k install -n "www2" -f "G:\wamp\Apache2\conf\web2.conf" 035courier new3551arial5166courier new6667Arial066#ff00006667#333333067#ffffff2099-1559799549277后按回车就可以了。 09courier new910Arial09#ff0000910#333333010#ffffff7177-1559799549277然后我们在www2下放一个html文件来做测试,在ie输入 http://localhost:8080 OK。服务正常 060Arial030#3333333051#0070af5160#333333060#ffffff3051http://localhost:8080/7730-15597995492781378-1559799549278第二要做的就是服务安装好之后 就是怎么用wamp控制台来控制新安装的服务了 038Arial038#333333038#ffffff4959-1559799549280一、打开wamp目录,找到wampmanager.ini用编辑器打开(用什么编辑器无所谓了,记事本就可以) 054Arial054#333333054#ffffff6400-1559799549280二、主要更改的有(更改过的是红色的) 019Arial019#333333019#ffffff1653-15597995492811 02Arial01#ff000012#33333302#ffffff9861-1559799549281[Services] 011Arial011#333333011#ffffff4281-1559799549281Name: wampapache 017Arial017#333333017#ffffff1619-1559799549282Name: wampmysqld 017Arial017#333333017#ffffff4048-15597995492829159-1559799549283[Services] 011Arial011#ff0000011#ffffff3939-1559799549283Name: wampapache 017Arial017#ff0000017#ffffff7958-1559799549283Name: wampmysqld 017Arial017#ff0000017#ffffff4092-1559799549283Name: www2 011Arial010#ff00001011#333333011#ffffff2437-15597995492846470-15597995492842 02Arial01#ff000012#33333302#ffffff4059-1559799549284[StartupAction] 016Arial016#333333016#ffffff6435-1559799549285Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#333333086#ffffff4960-1559799549287Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#333333086#ffffff0090-15597995492897598-1559799549289[StartupAction] 016Arial016#ff0000016#ffffff1827-1559799549289Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#ff0000086#ffffff9438-1559799549290Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#ff0000086#ffffff3658-1559799549292Action: service; Service: www2; ServiceAction: startresume; Flags: ignoreerrors 080Arial079#ff00007980#333333080#ffffff1830-15597995492933765-15597995492933 02Arial02#33333302#ffffff2325-1559799549293[Menu.Left] 012Arial012#333333012#ffffff8285-1559799549293Type: separator; Caption: "WAMP5" 034Arial034#333333034#ffffff1059-1559799549294Type: item; Caption: "Localhost"; Action: run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/"; Glyph: 5 0126Arial097#33333397114#0070af114126#3333330126#ffffff97114http://localhost/7722-1559799549297Type: item; Caption: "phpMyAdmin"; Action: run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/phpmyadmin/"; Glyph: 5 0138Arial098#33333398126#0070af126138#3333330138#ffffff98126http://localhost/phpmyadmin/2937-1559799549299Type: item; Caption: "www 目录(&)"; Action: shellexecute; FileName: "G:/wamp/www"; Glyph: 5 090Arial090#333333090#ffffff5334-15597995493001195-1559799549300[Menu.Left] 012Arial012#ff0000012#ffffff3242-1559799549300Type: separator; Caption: "WAMP5" 034Arial034#ff0000034#ffffff3715-1559799549302Type: item; Caption: "Localhost"; Action: run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/"; Glyph: 5 0126Arial0126#ff00000126#ffffff97114http://localhost/1090-1559799549304Type: item; Caption: "Localhost:8080"; Action: run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost:8080/"; Glyph: 5 0136Arial0136#ff00000136#ffffff102124http://localhost:8080/7676-1559799549307Type: item; Caption: "phpMyAdmin"; Action: run; FileName: "C:\WINDOWS\explorer.exe"; Parameters: "http://localhost/phpmyadmin/"; Glyph: 5 0138Arial0138#ff00000138#ffffff98126http://localhost/phpmyadmin/7929-1559799549309Type: item; Caption: "www 目录(&)"; Action: shellexecute; FileName: "G:/wamp/www"; Glyph: 5 090Arial090#ff0000090#ffffff8457-1559799549310Type: item; Caption: "www2目录(&)"; Action: shellexecute; FileName: "G:/wamp/www2"; Glyph: 5 091Arial090#ff00009091#333333091#ffffff5011-15597995493127060-15597995493124 02Arial02#33333302#ffffff7979-1559799549312[StartAll] 011Arial011#333333011#ffffff9813-1559799549312Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#333333086#ffffff7056-1559799549314Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#333333086#ffffff9343-15597995493159632-1559799549315[StartAll] 011Arial01#333333111#ff0000011#ffffff2765-1559799549315Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors 086Arial086#ff0000086#ffffff1523-1559799549317Action: service; Service: www2; ServiceAction: startresume; Flags: ignoreerrors 080Arial080#ff0000080#ffffff5972-1559799549318Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors 086Arial085#ff00008586#333333086#ffffff6742-15597995493195613-15597995493195 02Arial02#33333302#ffffff2645-1559799549319[StopAll] 010Arial010#333333010#ffffff9277-1559799549320Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors 079Arial079#333333079#ffffff9054-1559799549321Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors 079Arial079#333333079#ffffff8624-15597995493236592-1559799549323[StopAll] 010Arial010#ff0000010#ffffff7546-1559799549323Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors 079Arial079#ff0000079#ffffff5693-1559799549324Action: service; Service: www2; ServiceAction: stop; Flags: ignoreerrors 073Arial073#ff0000073#ffffff5262-1559799549325Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors 079Arial078#ff00007879#333333079#ffffff2562-15597995493272817-15597995493276 02Arial02#33333302#ffffff9938-1559799549327[RestartAll] 013Arial013#333333013#ffffff1549-1559799549328Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated 099Arial099#333333099#ffffff4486-1559799549329Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors waituntilterminated 099Arial099#333333099#ffffff1145-1559799549331Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated 0106Arial0106#3333330106#ffffff9312-1559799549332Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated 0106Arial0106#3333330106#ffffff2170-15597995493346853-1559799549334[RestartAll] 013Arial013#ff0000013#ffffff1224-1559799549335Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated 099Arial099#ff0000099#ffffff9244-1559799549336Action: service; Service: www2; ServiceAction: stop; Flags: ignoreerrors waituntilterminated 093Arial093#ff0000093#ffffff6224-1559799549337Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors waituntilterminated 099Arial099#ff0000099#ffffff8997-1559799549338Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated 0106Arial0106#ff00000106#ffffff5114-1559799549340Action: service; Service: www2; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated 0100Arial0100#ff00000100#ffffff1025-1559799549342Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated 0106Arial0105#ff0000105106#3333330106#ffffff3086-15597995493435089-15597995493437 02Arial02#33333302#ffffff6044-1559799549344[myexit] 09Arial09#33333309#ffffff6247-1559799549344Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors 079Arial079#333333079#ffffff2041-1559799549345Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors 079Arial079#333333079#ffffff9074-1559799549346Action: exit 013Arial013#333333013#ffffff7645-15597995493465144-1559799549346[myexit] 09Arial09#ff000009#ffffff2850-1559799549347Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors 079Arial079#ff0000079#ffffff5940-1559799549348Action: service; Service: www2; ServiceAction: stop; Flags: ignoreerrors 073Arial073#ff0000073#ffffff1487-1559799549349Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors 079Arial079#ff0000079#ffffff7531-1559799549350Action: exit 013Arial012#ff00001213#333333013#ffffff3421-15597995493503350-1559799549350三、更改完成之后保存,并重启wamp就ok了。下面图是我在机子上装有3个服务之后的样子了。 046Arial046#333333046#ffffff9460-15597995493512739-15597995493512912-1559799549352我不说具体的更改的用处是希望大家能自己琢磨下,想表达的观点:最好学习方法就是实践 041Arial041#333333041#ffffff8592-15597995493536391-1559799549353最后,看帖子要顶哦09Arial09#33333309#ffffff
用户评论