Installingrewritebase

rewritebase  时间:2021-02-20  阅读:()
CopyrightIBMCorporation2013TrademarksCreatingaDrupalmultisiteinstallationPage1of10CreatingaDrupalmultisiteinstallationCreatemultipleDrupalsitesfromasinglecodebaseandmultipledatabasesTimiOgunjobiApril30,2013OneimportantfeatureoftheDrupalcontentmanagementsystemisthatitenablesyoutorunmultiplewebsitesfromasinglebaseinstallationoftheframework—afeaturecalledmultisiteinstallations.
Suchinstallationsareparticularlyusefultowebadministratorswhohavetomanageandmaintainseveralsitesonalong-termbasis,andthefunctionalitysimplifiestheadministrationofmultipleDrupalinstallationslocatedonthesameserverbymakingallofthemrunfromasinglescript.
Inthisarticle,seehowtoinstall,configure,run,andadministermultisiteDrupal.
Therearemanyreasonswhyasystemsadministratorordevelopermaychoosetohostmultiplesitesonthesameserverinamultisiteconfiguration.
Forexample,suchaconfigurationcould:EnableyoutobuildanefficientdevelopmentenvironmentAllowyoutostageandtestasitebeforeitgoespublicLetyourundifferentsoftwareonthesamesiteEnablesharingofasinglecodebaseacrossseveralsitesLeveragesharedhostingAllowyoutorunsimilarsecure(HTTPoverSecureSocketsLayer[HTTPS])andstandard(HTTP)sitesonthesameserverEaseserveradministrationNotallofthesereasons,however,arebestaddressedwithDrupal'smultisitefeature.
Thisarticlesfocusesonjustonestrategy:howtouseDrupal'sbuilt-inmultisitesupporttocreateandserveseveralsitesfromoneinstanceofDrupal.
BasicconsiderationsUsingtheDrupalcontentmanagementsystem(CMS)tocreateamultisiteconfigurationhasseveraldistinctadvantages,oneofwhichisthatitisprobablytheeasiestconfigurationtosetupandmaintain.
AnotheristhatdataduplicationisminimizedbecauseDrupalisinstalledinonlyoneplaceonyourserver.
Finally,DrupalhasawealthofcontributedmodulesthatcanbeusedtodeveloperWorksibm.
com/developerWorks/CreatingaDrupalmultisiteinstallationPage2of10augmentmultisitehandling,offeringadvancedcapabilitiestoallthesitesinthearrangement.
Thecombinationofaddedfeaturesandsimplifiedadministrationwouldbeaboonforanyonewantingtosetupandadministeramultisitearrangement.
Nevertheless,thereareafewdrawbackstousingsuchaconfiguration,andtwoinparticulardeserveclearmention:securityandsharing.
Thesitesinamultisiteinstallationsharethesamecodeandthusthesamefiles.
Asaresult,anyonewhogainsaccesstotheserver'sfilesystemforonesitealsohasaccesstoallthefilesusedforallofthesitesonthatmultisiteinstallation.
Therefore,incaseswheredifferentpeoplearemanagingdifferentsiteswithinthearrangement,itmaynotbequitesecure.
Ifsecurityamongsitesisaprimaryissue,orifdifferentpeoplemanagethevarioussites,Drupal'sbuilt-inmultisitefunctionalitymaynotbethebestsolution.
Instead,considergivingeachsiteitsowndistinctDrupalinstance.
Althoughtheadvantagesofeasieradministrationthatthemultisitearrangementaffordswillbelost,yoursiteswillbebetterprotectedfrommishaps.
Thesecondconcern—sharing—centersarounddatabaseaccess.
EventhoughDrupal'smultisitessharethesamesourcecode,theydonotsharethesamedatabasedata.
Thus,nodes,users,andcommentsinonesitearenotaccessiblebydefaultfromothersites.
Thisbehaviorcanactuallyberegardedasagoodthing,butinsituationswheretheadministratormayrequirethatallthesitesshareinformation,itmaybealimitationforthedesignofDrupal'smultisitefeature.
Nevertheless,thesweetspotforDrupal'sbuilt-inmultisitesupportisthatmodules,themes,and,eventosomeextent,uploadedfiles,canbesharedacrossallthesites.
Inaddition,thesameorcustomfilescanberetainedindifferentfolderscorrespondingtothedifferentsitesintheconfiguration.
Ifit'simportantthatallcontentbeshared,considerusingamultidomainfeature,whichiseasilyprovidedbyamoduleofthesamename.
InstallingDrupalformultisiteuseAfterdownloadingtheDrupalarchive(seeRelatedtopicsforalink),extractthefileandcopytheresultingfoldertothedocumentrootofyourwebserver.
Thistaskisn'tdifficultwithasuitableFTPclient;withSecureShell(SSH)accesstoyourserver,thetaskiseveneasier.
Simplyrunawgetcommandtodownloadthearchivefilefromtherepository,andextractittoproducetheDrupalinstallationfolder.
(Ifyourdevelopmentenvironmentislocal,standbyformoreoptions.
)Nametheinstallationfolder/goodsite.
Threedifferentsiteswillbecreatedforthisexercise;therefore,threedifferentdatabasesareneeded—oneforeachsite.
UsingphpMyadminfromtheCpanelofyourserver,thistaskiseasilyaccomplished.
Next,installtheframework.
Twotasksmustbeperformed,however,beforeusingyourwebbrowsertoruntheinstaller:ProvideDrupalwiththeinformationitneedsaboutthesitesyouintendtorun.
Passthesite-specificconfigurationdatafromDrupaltoallofthesites.
Toachievethefirsttask,createaspecialdirectoryforeachsite.
Forthesecond,locateasettingsfileineachdirectory.
Theobjectiveistosetuponemasterinstallationwithtwosub-sites.
Eachsub-sitesharesthesamefilesasthecore,buteachwillhaveitsownseparateURLanddatabase.
TheURLsofthesitestobecreatedare:ibm.
com/developerWorks/developerWorksCreatingaDrupalmultisiteinstallationPage3of10Mastersite:http://goodsite.
comSub-site1:http://bettersite.
comSub-site2:http://bestsite.
comInstallingthefirsthostAfterplacingtheDrupalsourcecodeinthedocumentrootandhavingcreatedtheMySQLdatabases,begininstallingthefirstsiteandthemasterdomain.
ThemasterdomainThemasterdomainnameistheURLfromwhichthemainsitewillbeaccessed(inthisarticle,http://goodsite.
com).
TheprimarypurposeofthemasterdomainistohostthebaseDrupalinstallation.
Regardlessofwhetherthisdomainisusedasoneofyoursites,ifanysub-sitesfails,theirURLswilldefaulttothemasterdomain;therefore,itisagoodideathatthissitecontaininformationrelevanttothesub-sites,suchascontactinformation.
Asmentioned,asubfoldermustbecreatedwithinthemainDrupalfolderforeachsub-site.
WhatmanywouldimaginethemostdifficulttaskinDrupal'smultisiteinstallationissimplyroutine:LetDrupalknowwhatsitesyouwanttohost,andsimplycreatesubfoldersforthosesitesinthe/sitesfolder.
IntheDrupalmainrootfolderisadirectorycalled/sites.
Ifyou'veadministeredDrupalbefore,youknowallnon-corecodeoughttoresidewithinthisfolder.
InthedefaultDrupalinstallation,the/sitesfoldercontainstwodirectories.
Thefirst,calledall/,iswhereyoushouldputdownloadedthemesandmodules.
Theall/directoryisthelocationforinformationsharedacrossallsites.
Thesecondfolder,nameddefault/,iswhereconfigurationfilesshouldbekept,aswellasnon-coreandcustomthemesandmodules.
Drupaltypicallysearchesthedefault/directoryforsiteconfigurationinformationunlessitisinstructedotherwise.
Note,however,thattheseareassumptionsforageneric,single-hostsite—notnecessarilyforamultisiteinstallation.
CreatingthesubfoldersandfilesAbigtipforbuildingmultisiteDrupalisthatapartfromtheall/anddefault/folders,otherfolderscanbecreatedin/sites,andDrupalwillassignthemspecialmeaning.
Morespecifically,Drupalassumesthatallotherdirectoriesfoundinthe/sitesfolderrepresentahostnameorahostnamepattern.
Youcreateasubfolderinthepattern/goodsite/sites/underthe/sitesfolderforallsub-sites,substitutingyourintendedURLforthenameofeachsub-sitefolder.
Inthisexample,youhavethefollowingsub-sites,asshowninFigure1.
Sub-site1:/goodsite/sites/bettersiteSub-site2:/goodsite/sites/bestsitedeveloperWorksibm.
com/developerWorks/CreatingaDrupalmultisiteinstallationPage4of10Figure1.
The/sitesfolderhierarchyForeachsub-site,completethefollowingsteps:1.
Copythefiledefault.
settings.
phpfromsites/defaulttoeachsub-sitefolder,andrenameitsettings.
php.
2.
UseCHMODtosetthepermissiononsettings.
phpto644,ifitisnotthecurrentpermission.
3.
ForaDrupal,Version6installation,createafoldernamedfilesundereachsub-site,anduseCHMODtochangethepermissionto755.
ThisisafolderinsidewhichDrupalisabletowritecontent—typically,uploadedfiles,imagethumbnails,aggregatedCascadingStyleSheet(CSS),andJavaScriptfiles.
Thesefilesarenotstoredinthedatabase,butratherinthefilesystem,soyoumusthaveadirectoryinwhichthesefilescanreside.
Bydefault,Drupallooksforasubdirectorynamedfiles/withinthedirectoryofeverysite.
InadefaultDrupalinstallation,thisfolderwouldbeinsites/default/files/.
4.
Createafoldercalledmodulesforeachsub-site.
Thisisthefolderinwhichanymodulesspecifictothatsub-sitereside.
Anymodulesthatallsiteswilluseshouldresideinthesites/all/modulesfolder.
5.
Createafoldercalledthemesforeachsub-site.
Thisiswhereanythemesuniquetothatsub-siteareplaced.
Anythemethatallsiteswilluseshouldresideinsites/all/themes.
Now,pointthesub-siteURLstoyourwebserver,iftheyarenotadministeredbythesamehostingcompany.
Ifyouusedifferenthostsforthevarioussites,youwillneedtochangetheDomainNameSystem(DNS)information(boththeregistrarsandthehostingcompaniesshouldbeabletotellyouhowtodoso).
Thereafter,youwillhaveto"park"thatdomainontopofyourprimarydomain—inthiscase,goodsite.
com.
Fromthispoint,youhaveafewalternatives,themoredifficultofwhichinvolvesusingwhat'scalledasymlink.
Parkingismuchsimpler,however;soinyourCpanel,clickonParkedDomains.
Addbettersite.
comandbestsite.
cominNewDomainName,andthenclickonAddDomain.
CreatingthemultisitesThereareseveralwaystogofromhere,butagain,let'staketheeasiestroute:directlyloadingthedatabaseforeachsub-sitewiththetablescreatedinthemastersiteinstallation.
Todoso,youibm.
com/developerWorks/developerWorksCreatingaDrupalmultisiteinstallationPage5of10mustcreateadumpofthedatabasetablesfromthemastersiteinstallationandsaveitlocally.
Then,eitheruploadthisfilewithphpMyadminoropenitusingacodeeditor.
Tousethesecondoption,performthesetaskswithinphpMyadmin:1.
Gotothedatabasecreatedforthesub-site.
2.
GotoSQL,andthenpasteallofthecodefromtheStructuredQueryLanguage(SQL)dumpthere.
3.
ClickonGo.
Thisprocedurereproducesthemastersitedatabasetablesinthesub-sitedatabase.
Next,openthesettings.
phpfileforeachsub-site,andlookforthefollowingline:$db_url='mysql://username:password@localhost/databasename';Changethisdatabaseconnectingstringtoreflecttheparametersforthesub-sitedatabase(username,password,hostname,databasename).
Nowifyougotobettersite.
com,youshouldgetthestandard"WelcometoyournewDrupalwebsite"page,asshowninFigure2.
Repeatthesestepsforalladditionalsites.
Figure2.
YournewwebsiteinDrupalCreatingmultisitesfromsub-domainsThereisanotherwaytoquicklycreatemultisitesbyfirstdetailingthemassub-domainsfromtheCpanel.
Inthismethod,however,youmustinitiallycreatefoldersforeachsiteunder/goodsite/sites,thistimeusingthefollowingconvention(seeFigure3):Sub-site1:/www/goodsite/sites/bettersite.
comSub-site2:/www/goodsite/sites/bestsite.
comdeveloperWorksibm.
com/developerWorks/CreatingaDrupalmultisiteinstallationPage6of10Figure3.
Creatingmultisitesfromsub-domainsNotethatthesub-domainfoldersmusthavethesamenamesasthesub-domainsthemselves.
Asbefore,putacopyofdefault.
settings.
phpineachsub-domainfolder,changethefilenametosettings.
php,andissueCHMODtochangethepermissionto644.
Now,returntoCpanelandcreatetwosub-domains:bettersite.
goodsite.
combestsite.
goodsite.
comCreateasymlinkAsymlinkisafilethatcontainsareferencetoanotherfileorfolderintheformofanabsoluteorrelativepathandiscreatedtoaffectpathnameresolution.
Useanycodeeditortocreateafilecalledsymlink.
php,andthenaddcodesimilartothefollowing:Inthiscase,thefilewouldlooksomethinglikethis:Putthissymlinkinthemaindirectoryofthemainsite,andrunitfromtheURLhttp://goodsite.
com/symlink.
php.
Ifthecodesyntaxisgood,youshouldseeablankpage;otherwise,youwillseeerrormessages.
Tweakthecodeinthisfileuntilitcomesoutcorrectly.
Configure.
htaccessNowopenthe.
htaccessfileinanycodeeditor.
Lookforthefollowingline:#RewriteBase/ibm.
com/developerWorks/developerWorksCreatingaDrupalmultisiteinstallationPage7of10Removethehashsign(#),andaddthefollowinglinebeforesavingthechanges:RedirectMatch301^/sub-domain/(.
*)$http://sub-domain.
yoursite.
com$1Here'swhat.
htaccessshouldlooklikewhenfinished:RewriteBase/RedirectMatch301^/bettersite/(.
*)$http://bettersite.
goodsite.
com/$1RedirectMatch301^/bestsite/(.
*)$http://bestsite.
goodsite.
com/$1Thisredirectionmakesitpossibleforbothhttp://goodsite.
com/bettersiteandhttp://bettersite.
goodsite.
comtoberedirectedtothesamesite.
Ifeverythinghasbeendonecorrectly,youwillbedirectedtotheinstallationpagewhenyouaccessthesub-siteURLshttp://bettersite.
goodsite.
comandhttp://bestsite.
goodsite.
com.
Withallthesitesinstalled,it'seasyfromtheCpaneltoassociatethesitehttp://bettersite.
goodsite.
comusingaredirecttotheURLhttp://bettersite.
com.
MultisiteonalocalhostrunningUbuntuRunningamultisiteinstallationonUbuntuisabitmorecomplicatedthanwhatyouhavedonesofarforremotehosting.
Amultisiteinstallationcanbeeasilyconfiguredusingthemethodoutlinedinthefollowingsections.
CreateanewhostsfolderBeginbycreatingafoldercalledgoodsiteinyourhomefolderusingthefollowingcode:>>filesystem/home//Theresultshouldbe->/home//goodsite.
NowcopyallyourDrupalfilesintothisfolder.
EditthehostsfileEditthehostsfilebyopeningaterminalwindowwiththefollowingcommand:sudogedit/etc/hosts'Youcanthenaddanysitenameintheformat127.
0.
0.
1mysite.
com.
Forthisexample,addthefollowinglines:127.
0.
0.
1goodsite.
com127.
0.
0.
1bettersite.
com127.
0.
0.
1bestsite.
comEditthesitesavailableNowgotothesites-availablefoldertocreateafilecalledgoodsite.
comusingthefollowingcommands:developerWorksibm.
com/developerWorks/CreatingaDrupalmultisiteinstallationPage8of10cd/etc/apache2/sites-availablesudocpdefaultgoodsite.
comsudogeditgoodsite.
comThefirstcommandgoestothesites-availablefolder;thesecondcommandcopiesthedefaultfileandrenamesitgoodsite.
com.
Thethirdcommandopensthefilegoodsite.
comforediting.
AddthecodeshowninListing1tothefile.
Listing1.
Additiontothesites-availablefolderfileforthenewsiteServerAdminwebmaster@localhostServerNamegoodsite.
comDocumentRoot/home//goodsiteOptionsFollowSymLinksAllowOverrideAllSavegoodsite.
com,enableit,andthenreloadApacheusingthefollowingcommands:sudoa2ensitemysite.
comsudo/etc/init.
d/apache2reloadCreatesub-sitefoldersCreateyoursub-siteinthe/sitesfolder/home/[yourubuntuloginname]/goodsite/sites/bettersite.
com,andthenaddsettings.
phptothenewfolder.
Ifyouhavealreadynavigatedtothesites/directory,copythesettings.
phpfilewiththefollowingcommand:$cpdefault/default.
settings.
phpbettersite.
com/settings.
php$chmod777bettersite.
com/settings.
phpRunsub-siteinstallationOpenyourbrowser,thentypehttp://bettersite.
com.
Youshouldseetheinstallationsetuppage.
Makethesettings.
phpfileread-onlyagaintoavoidsecuritymessages,thenrunthesub-siteinstallation.
Next,createasitefolderandruntheinstallationforbestsite.
comaswellasanyothersub-sitesmentionedinyourhostsconfiguration.
MultisitemodulesModulesareusedtoextendthefunctionalityofabasicDrupalinstallationandcomeinvariouscategories,fromadministrativetoactualperformance-enhancementfunctionalities.
Severalmodulescanassistincreatingamultisiteorsimilarconfiguration.
Fordetailsonhowtousethesemodules,consulttheinstallationdocumentationforeachmodule.
TheDomainAccessmodulesTheDomainAccessmodules(seeRelatedtopicsforalink)enablethecreationofamultisiteusingasinglecodebase,ashareduserdatabase,andsharedsign-onbutwithdifferentcontentibm.
com/developerWorks/developerWorksCreatingaDrupalmultisiteinstallationPage9of10databases.
Suchaconfigurationisdifferentfromwhatwehavedoneinthisarticle.
DomainAccessisactuallydescribedasasetofmodulesthatfacilitaterunningagroupofsitesbyusingonebasicDrupalcodeinstalledinsideasingleshareddatabase.
Thesemodulesenableallofthesitestoshareusers,content,andsettingsiftheyhavebeenpreconfiguredtooperateinsuchaway.
TheDomainAccessmodulesemployDrupal'sNodeAccessSystemtoestablishwhichcontentshouldbemadeavailableoneachsiteinthemultisitearrangement.
Themodules,unlikeothermultidomainmodules,alsocontroluseraccessonthebasisoftheactivedomaintheuserisviewing,notonthebasisofthegrouporsitetowhichtheuserbelongs.
TheMultisiteManagermoduleTheMultisiteManager(seeRelatedtopicsforalink)isacontributedmodulethatallowscreationofnewDrupalsitesfromabaseDrupalsitewithouttheneedtoaccesstheinstallationdatabase.
Bydefault,thenewsiteisinstalledinthesamedatabaseasthebaseinstallation,butwithadifferentprefix.
Otherwise,ifthecurrentuserhasaccesspermissiontocreateadatabase,theinstallationcouldpossiblybedoneinthatdatabase.
ConclusionThisarticleexploredhowtocreateamultisitesconfigurationusingDrupalasthebaseCMS.
Youinstalledthemastersiteandlocatedthesub-siteswithinitsdirectorystructure.
Youlearnedhowtorunmultisiteinstallationsonaremoteserverbyusingtheadministrativefacilitiesyourhostingcompanyprovides.
Youalsolearnedhowtocreateamultisiteinstallationonalocalmachine—specifically,onacomputerrunningUbuntuLinux.
ThisarticlealsointroducedtwoDrupalmodulesthatcanassistyouinthecreationofbothmultisiteandmultidomainconfigurations.
developerWorksibm.
com/developerWorks/CreatingaDrupalmultisiteinstallationPage10of10RelatedtopicsDownloadthelatestversionofDrupal.
LearnmoreabouttheDomainAccessmodules.
LearnmoreabouttheMultisiteManagermodule.
CopyrightIBMCorporation2013(www.
ibm.
com/legal/copytrade.
shtml)Trademarks(www.
ibm.
com/developerworks/ibm/trademarks/)

免费注册宝塔面板账户赠送价值3188礼包适合购买抵扣折扣

对于一般的用户来说,我们使用宝塔面板免费版本功能还是足够的,如果我们有需要付费插件和专业版的功能,且需要的插件比较多,实际上且长期使用的话,还是购买付费专业版或者企业版本划算一些。昨天也有在文章中分享年中促销活动。如今我们是否会发现,我们在安装宝塔面板后是必须强制我们登录账户的,否则一直有弹出登录界面,我们还是注册一个账户比较好。反正免费注册宝塔账户还有代金券赠送。 新注册宝塔账户送代金券我们注册...

RackNerd:便宜vps补货/1核/768M内存/12G SSD/2T流量/1G带宽,可选机房圣何塞/芝加哥/达拉斯/亚特拉大/荷兰/$9.49/年

RackNerd今天补货了3款便宜vps,最便宜的仅$9.49/年, 硬盘是SSD RAID-10 Storage,共享G口带宽,最低配给的流量也有2T,注意,这3款补货的便宜vps是intel平台。官方网站便宜VPS套餐机型均为KVM虚拟,SolusVM Control Panel ,硬盘是SSD RAID-10 Storage,共享G口带宽,大流量。CPU:1核心内存:768 MB硬盘:12 ...

JUSTG(5.99美元/月)最新5折优惠,KVM虚拟虚拟512Mkvm路线

Justg是一家俄罗斯VPS云服务器提供商,主要提供南非地区的VPS服务器产品,CN2高质量线路网络,100Mbps带宽,自带一个IPv4和8个IPv6,线路质量还不错,主要是用户较少,带宽使用率不高,比较空闲,不拥挤,比较适合面向非洲、欧美的用户业务需求,也适合追求速度快又需要冷门的朋友。justg的俄罗斯VPS云服务器位于莫斯科机房,到美国和中国速度都非常不错,到欧洲的平均延迟时间为40毫秒,...

rewritebase为你推荐
中国联通话费查询中国联通话费查询拨打什么号51自学网站有哪些免费自学网人人时光机求 《小叮当》的日语歌词。最好有片假名的中国论坛大全天涯论坛的网址?qq空间装扮qq空间的装扮空间在哪?什么是云平台什么是云平台管理软件,一个云平台软件应该具有哪些基本功能网站优化方案网站优化方案应该从哪些方面去分析?QzongQQ空间是Qzone还是Qzong微信电话本怎么用微信电话本如何使用?网站营运网站运营都分为哪些方面
jsp虚拟主机 哈尔滨域名注册 中文域名申请 大硬盘 fastdomain 网站监控 日志分析软件 网站挂马检测工具 元旦促销 美国十次啦服务器 天互数据 howfile adroit 可外链相册 phpmyadmin配置 网游服务器 海外空间 789 免费asp空间 中国电信测速网站 更多