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

华纳云不限流量¥324/年,香港双向CN2(GIA)云服务器/1核1G/50G存储/2Mbps

华纳云(HNCloud Limited)是一家专业的全球数据中心基础服务提供商,总部在香港,隶属于香港联合通讯国际有限公司,拥有香港政府颁发的商业登记证明,保证用户的安全性和合规性。 华纳云是APNIC 和 ARIN 会员单位。主要提供香港和美国机房的VPS云服务器和独立服务器。商家支持支付宝、网银、Paypal付款。华纳云主要面向国内用户群,所以线路质量还是不错的,客户使用体验总体反响还是比较好...

raksmart:全新cloud云服务器系列测评,告诉你raksmart新产品效果好不好

2021年6月底,raksmart开发出来的新产品“cloud-云服务器”正式上线对外售卖,当前只有美国硅谷机房(或许以后会有其他数据中心加入)可供选择。或许你会问raksmart云服务器怎么样啊、raksm云服务器好不好、网络速度快不好之类的废话(不实测的话),本着主机测评趟雷、大家受益的原则,先开一个给大家测评一下!官方网站:https://www.raksmart.com云服务器的说明:底层...

月费$389,RackNerd美国大硬盘独立服务器

这次RackNerd商家提供的美国大硬盘独立服务器,数据中心位于洛杉矶multacom,可选Windows、Linux镜像系统,默认内存是64GB,也可升级至128GB内存,而且硬盘采用的是256G SSD系统盘+10个16TSAS数据盘,端口提供的是1Gbps带宽,每月提供200TB,且包含5个IPv4,如果有需要更多IP,也可以升级增加。CPU核心内存硬盘流量带宽价格选择2XE5-2640V2...

rewritebase为你推荐
flash导航条如何添加FLASH导航条安卓应用平台有没有什么安卓游戏都能找到的应用商店或者游戏中心qq空间打扮如何打扮QQ空间?安装迅雷看看播放器迅雷看看播放器安装宕机人们说的宕机是什么意思ios系统iOS系统为什么那么好iphone6上市时间苹果6什么时候出?厦门铁通厦门铁通宽带可以免费升级到2m么?ncsettingsbsettings . ncsettings vs 金山快捷键,你们在用那一种?安装版xp系统盘电脑xp系统的纯净版,安装版,装机版分别是什么意思?
域名备案批量查询 国外免费域名网站 已经备案域名 圣诞节促销 100x100头像 赞助 百度云1t umax120 1美金 免费mysql数据库 上海电信测速 免费asp空间申请 可外链的相册 789电视剧网 japanese50m咸熟 蓝队云 sonya 侦探online 日本小学生 内存 更多