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

wordpress外贸集团企业主题 wordpress高级推广外贸主题

wordpress外贸集团企业主题,wordpress通用跨屏外贸企业响应式布局设计,内置更完善的外贸企业网站优化推广功能,完善的企业产品营销展示 + 高效后台自定义设置。wordpress高级推广外贸主题,采用标准的HTML5+CSS3语言开发,兼容当下的各种主流浏览器,根据用户行为以及设备环境(系统平台、屏幕尺寸、屏幕定向等)进行自适应显示; 完美实现一套主题程序支持全部终端设备,保证网站在各...

CloudCone中国新年特别套餐,洛杉矶1G内存VPS年付13.5美元起

CloudCone针对中国农历新年推出了几款特别套餐, 其中2019年前注册的用户可以以13.5美元/年的价格购买一款1G内存特价套餐,以及另外提供了两款不限制注册时间的用户可购买年付套餐。CloudCone是Quadcone旗下成立于2017年的子品牌,提供VPS及独立服务器租用,也是较早提供按小时计费VPS的商家之一,支持使用PayPal或者支付宝等付款方式。下面列出几款特别套餐配置信息。CP...

注册做什么96%可以干啥,常用的7个常用的国内国外域名注册服务商_云服务器可以干什么

日前,国内知名主机服务商阿里云与国外资深服务器面板Plesk强强联合,推出 阿里云域名注册与备案、服务器ECS购买与登录使用 前言云服务器(Elastic  只需要确定cpu内存与带宽基本上就可以了,对于新手用户来说,我们在购买阿里云服务申请服务器与域名许多云服务商的云服务器配置是弹性的 三周学会小程序第三讲:服务 不过这个国外服务器有点慢,可以考虑国内的ngrokcc。 ngrokcc...

rewritebase为你推荐
手机游戏排行榜20152015有什么手机游戏好玩?绵阳电信绵阳电信宽带资费中国电信互联星空互联星空是什么?是电信公司的吗?网店推广网站开网店如何做推广?腾讯文章怎么在手机腾讯网发文章直播加速有没有软件使已经下载好了的视频播放加速,例如30分钟的视频15分钟或者20分钟播放完开机滚动条如何关闭开机滚动条?如何快速收录如何让百度快速收录电子商务网站模板电子商务网站模板哪个好?电子商务网站模板免费建站怎么样?什么是云平台谁能简单说一下什么是云平台啊?
虚拟空间免费试用 购买域名和空间 万网域名管理 arvixe Dedicated suspended ibrs 100x100头像 双线主机 服务器是干什么的 购买国外空间 流媒体加速 卡巴斯基免费试用版 腾讯总部在哪 德讯 免费网络 lamp是什么意思 服务器硬件配置 privatetracker 美国服务器 更多