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

腾讯云CVM云服务器大硬盘方案400GB和800GB数据盘方案

最近看到群里的不少网友在搭建大数据内容网站,内容量有百万篇幅,包括图片可能有超过50GB,如果一台服务器有需要多个站点的话,那肯定默认的服务器50GB存储空间是不够用的。如果单独在购买数据盘会成本提高不少。这里我们看到腾讯云促销活动中有2款带大数据盘的套餐还是比较实惠的,一台是400GB数据盘,一台是800GB数据盘,适合他们的大数据网站。 直达链接 - 腾讯云 大数据盘套餐服务器这里我们看到当前...

牦牛云(3.5USD/月 )阿里云国际版云服务器 1核1G40G

收到好多消息,让我聊一下阿里云国际版本,作为一个阿里云死忠粉,之前用的服务器都是阿里云国内版的VPS主机,对于现在火热的阿里云国际版,这段时间了解了下,觉得还是有很多部分可以聊的,毕竟,实名制的服务器规则导致国际版无需实名这一特点被无限放大。以前也写过几篇综合性的阿里云国际版vps的分析,其中有一点得到很多人的认同,那句是阿里云不管国内版还是国际版的IO读写速度实在不敢恭维,相对意义上的,如果在这...

CloudCone:$14/年KVM-512MB/10GB/3TB/洛杉矶机房

CloudCone发布了2021年的闪售活动,提供了几款年付VPS套餐,基于KVM架构,采用Intel® Xeon® Silver 4214 or Xeon® E5s CPU及SSD硬盘组RAID10,最低每年14.02美元起,支持PayPal或者支付宝付款。这是一家成立于2017年的国外VPS主机商,提供VPS和独立服务器租用,数据中心为美国洛杉矶MC机房。下面列出几款年付套餐配置信息。CPU:...

rewritebase为你推荐
湖南商标注册湖南哪里有商标注册公司?arm开发板单片机开发板与ARM开发板有什么不同?淘宝店推广给淘宝店铺推广有什么好处?硬盘人电脑对人有多大辐射?开机滚动条电脑开机滚动条要走好几次畅想中国用“心系祖国情,畅想中国梦”为题目的800字作文怎么点亮qq空间图标QQ空间图标怎么点亮?系统分析员一个优秀的系统分析师应该具备哪些方面的知识和素质?发邮件怎么发怎样发送邮件南北互通怎么知道是南北互通机房?
大庆服务器租用 免费顶级域名 bandwagonhost 美元争夺战 外国服务器 koss paypal认证 godaddy续费优惠码 美国php空间 40g硬盘 193邮箱 linux空间 免费防火墙 亚马逊香港官网 Updog 安徽双线服务器 上海电信测速 浙江服务器 中国联通宽带测试 大化网 更多