How to Troubleshoot and Fix 503 Errors on Your WordPress ...

文章推薦指數: 80 %
投票人數:10人

How to Fix the 503 Service Unavailable Error Skiptocontent BacktoBlog HowtoFixtheHTTP503ServiceUnavailableErrorinWordPress ByEditorialTeamOctober15,2021 WhenyouseeanerroronyourWordPresswebsite,yourfirstreactionmightbetofeelannoyedandfrustrated.Butdon’tworry!Mosterrorsareactuallyquitesimpletoresolve. The503ServiceUnavailableerrorisoneexample.Whileitcanseemtechnicalandconfusing,it’sactuallyquiteastraightforwarderror. Thesolutionsarebothalsoeasytodoanddon’trequireanydeeptechnicalknowledge. Inthispost,we’llwalkyouthroughfixingthe503ServiceUnavailableerror. First,we’lldiscusswhatcausesthiserrorandwhyyouareprobablyseeingit.Then,we’llgothroughsevendifferentpossiblesolutionstofixit.Finally,we’lltalkabouthowyoucanavoidseeingthiserrorinthefirstplace. Readytofixthe503ServiceUnavailableerror?Let’sgetstarted! TableOfContents WhatIsthe503ServiceUnavailableError?WhatCausesthe503ServiceUnavailableError?HowtoFixthe503ServiceUnavailableErrorCanYouPreventthe503ServiceUnavailableError?Fixingthe503HTTPServiceError:AWrap-up WhatIsthe503ServiceUnavailableError? TheHTTP503ServiceUnavailableErrorindicatesthatyourwebsite’sserverisunavailableandcannotloadyourpage.Thereareafewdifferentvariationsofitsname,butitwillusuallylooksomethinglikethis: 503ErrorHTTP503ErrorHTTPError503503–HTTPError503ServiceUnavailableServiceUnavailableTheserveriscurrentlyunavailableTheserveristoobusyrightnow,pleasetryagainlater Ifwelookattechnicaldocumentation,wecanseemoredetailaboutexactlywhatthismeans. W3.orgdefinesthe503erroras: Theserveriscurrentlyunabletohandletherequestduetoatemporaryoverloadingormaintenanceoftheserver.Theimplicationisthatthisisatemporaryconditionwhichwillbealleviatedaftersomedelay.Ifknown,thelengthofthedelayMAYbeindicatedinaRetry-Afterheader.IfnoRetry-Afterisgiven,theclientSHOULDhandletheresponseasitwouldfora500response. Theyalsohaveanoteindicatingthatifaserverisoverloaded,thatdoesn’tmeanitwillalwaysdisplaythe503error.Sometimesitjustwon’tconnectatall. Note:Theexistenceofthe503statuscodedoesnotimplythataservermustuseitwhenbecomingoverloaded.Someserversmaywishtosimplyrefusetheconnection. AndMozilla(makersoftheFirefoxbrowser)hasasimilardefinition: TheHyperTextTransferProtocol(HTTP)503ServiceUnavailableservererrorresponsecodeindicatesthattheserverisnotreadytohandletherequest.Commoncausesareaserverthatisdownformaintenanceorthatisoverloaded.ThisresponseshouldbeusedfortemporaryconditionsandtheRetry-AfterHTTPheadershould,ifpossible,containtheestimatedtimefortherecoveryoftheservice. Importantly,thiserrormeansthatyourwebsiteisonlinebutcannotbereachedforwhateverreason. ThisisunlikesomeothererrorswhichshowthatyourwebsiteisofflineentirelyorthatthereisanissuewithyourDNSsettings.Forexample,DNS_PROBE_FINISHED_NXDOMAINindicatesthatyourdomaincouldnotbefound. Beyondthis,theerrormessagedoesn’tcontainmuchinformationastohowyoushouldfixit.Itwillusuallyjustsay,“ServiceUnavailable”,whichdoesn’thelpusdiagnosetheproblem. Nottoworry,though,we’llgothroughallofthemostlikelycausesoftheproblemandshowyouhowtoaddressthem. Aquicknote:ifyouvisitthefrontendofyourWordPresssiteduringapluginorthemeupdate,youmayseethismessage.Ifyouarecurrentlyinthemiddleofupdatingthings,justwaitafewminutesandrefreshthepage. Iftheerrorgoesaway,thatwasmostlikelythecause. WhatCausesthe503ServiceUnavailableError? So,whatcausestheerror?Therearemanyreasonsastowhythishappens.Theserverisdown,it’stoobusy,it’sbeingrepairedormaintained,orthatthereisanissuewithyourparticularsite’srelationshiptotheserver. Itcanalsobeanissuewiththecodeonyoursite,usuallywithinaparticularplugin. Hello!MynameisSujayandI’mCEOofAstra. We’reonamissiontohelpsmallbusinessesgrowonlinewithaffordablesoftwareproductsandtheeducationyouneedtosucceed. Leaveacommentbelowifyouwanttojointheconversation,orclickhereifyouwouldlikepersonalhelportoengagewithourteamprivately. YourServerIsOverloaded Ifyourservercannothandlethecurrentamountoftrafficthatitisreceiving,youwilllikelyreceivethe503error.Thisisacommonproblemforsitesusingsharedhostingplans,whichareatthecheapestendofthehostingspectrum. Becauseyouaresharingaserver,othersitesonitalsoconsumeserverresources. AProblematicPluginorTheme Sometimes,apluginorthemethathasbeenimproperlycodedcancausethe503error.ThisisusuallyanissuewiththePHPcodeoftheplugin/theme,whichthencausesaproblemwiththeserver.Thisiswhyyoushouldonlyinstallreliablepluginsfromreliablesources. ACodeSnippetGoneRogue Ifyouhaveaddedacustomcodesnippettoyoursite,itcancausethe503error.Ifyouaddanycustomcode,besuretocheckitinatoollikePHPCodeChecker.com. Inaddition,youshouldalwaysbeverycarefulwhenaddingcustomcode(especiallyJavaScriptandPHP)toyoursiteifyouaren’taprogrammer.It’sveryeasytotakeyoursiteofflinewithafewmisplacedkeystrokes! Maintenance Ifyourserverisundermaintenance,itwillnormallydisplaythe503error.Usuallytherewillbeamessagethatindicatesthatmaintenanceisunderway. Forexample,WordPresswilldisplayabriefmessageindicatingthatthesiteisundermaintenance.Thishappenswhenyouupdatepluginsorthemesthatareactiveandenabled. Mostreputablehostswillgiveyouawarningbeforedoingsignificantmaintenance.Mostreputablehostswillhavemirroredserverswhichmeansyourwebsitewillalwaysbeavailableregardlessofwhatmaintenancemaybehappeningatthetime. ServerGlitch Sometimes,thereareminorglitches,errors,orotherproblemswiththeserver.Ifyouuseawebhostingplan(i.e.don’townyourownservers)thenthisissomewhatoutofyourcontrol.Justwaitabitandseeiftheerrorisresolved. Dependingonyourwebhost,youcanalsocontactsupportviachatand/oremailandseeiftheyareawareoftheerror.MosthostslikeSiteGroundhaveon-demandchatsupport. DDOSAttack Finally,aninfrequentbutpossiblecauseisthatyourserverisbeingDDOSed.Thisisunlikely,butstillhappens. AsaDDOSattackisessentiallythesamethingasoverloadingyourserver,youwillreceivethesame503message. HowtoFixthe503ServiceUnavailableError Nowthatweknowwhatthe503ServiceUnavailableErrorisandwhatcausesit,let’ssolveit! Asmentionedabove,therearemanydifferentpossiblecausesoftheerror.Thustherearemanydifferentpotentialsolutions. Let’sgothrougheachofthem,stepbystep. 1.WaitaFewMinutesandRefresh Beforedoinganything,itisagoodideatojustwaitafewminutesandrefreshyoursite.Oftentimes,serverissueswillberesolvedquicklybyyourhostinamatterofminutes. 2.TryaDifferentBrowserandUseIncognitoMode Likewise,sometimesyourcookiesandcachecaninterferewiththesite.Tryvisitingyoursitefromadifferentbrowserin“private”or“incognito”mode. 3.DeactivateandTroubleshootYourWordPressPlugins Stillhavetheerror?Then,thefirstthingyoushoulddoistroubleshootyourplugins.Thisway,wecanfigureoutiftheproblemiscausedbyyoursiteitselforiftheproblemiswiththeserver. Totroubleshootyourplugins,you’llneedtodeactivatethem.Unfortunately,youcan’tdothisthenormalwayintheWordPressdashboard,asyoursiteisinaccessibleduetothe503error. So,toconnecttoyoursite,you’llneedtouseFTP/SFTPorSSH.Ifyoudon’thaveaFTPclient,wegenerallyrecommendFileZilla. Connecttoyoursite.Ifyoudon’tknowwhatcredentialsyou’llneed,askyourhostorsearchfor“[hostname]connectFTP]”.Forinstance,herearesomeguidestoconnectingviaFTPforSiteGround. Onceyou’veconnected,findthewp-contentfolderandclickonit.Then,findthepluginsfolder. Renamethisfoldertoold-plugins.Then,createanewfolderandnameitplugins.Thiswilldeactivateallofthepluginsonyoursite. OpenyourWordPresssiteinyourbrowserandseeifthe503errorisstillthere. Ifyoustillseethe503error,thentheissueisunrelatedtotheplugins.Deletethenewpluginsfolderyoucreatedandthenrenameold-pluginsbacktojustplugins.Notethatyourpluginswillallbedeactivated,soyou’llneedtoreactivatethemintheWordPressdashboard(later,afteryou’veregainedaccesstoit.)Ifyoudon’tseethe503error,thatmeanstheerrorislikelycausedbyaplugin.Tofindoutwhichoneitis,gotoyourpluginspanelintheWordPressdashboardandreactivatethepluginsoneatatime,checkingthehomepageaftereachone.Whenyoudiscovertheculprit,connecttoyoursiteviaFTP/SFTPorSSHagain.Navigatetothewp-content/pluginsdirectoryanddeletethefolderforthatspecificplugin. 4.DeactivateYourWordPressTheme Similarlytoplugins,athemecanoftencausethisissue,especiallyifit’sacustomizedornon-standardone. Todeactivateyourtheme,firstconnecttoyoursiteviaFTP/SFTPorSSH.Inthewp-contentfolder,findthethemesfolder. Findthethemethatyouhaveactivatednowanddownloadittoyourcomputerforsafekeeping.Then,deleteitfromthewebserver. Gobacktoyoursiteandseeifthe503errorisstillthere. Iftheerrorisstillthere,thentheissuewasn’tthetheme.Youcansafelyreinstallit.Iftheerrorisnolongerthere,thenyouknowthatthethemewasthecause.Contactthetheme’sdevelopertoseeiftheycanfixtheissueanduseadifferentoneuntiltheydo. 5.EnableWP_DEBUG DebugmodeisasettinginWordPressthatwilldisplayalogofanyPHPerrors(andothererrors)rightonyoursite.It’sanexcellentwaytoseeexactlywhatthesourceofanissueis. Therearetwowaystoenabledebugmode:withapluginandbyeditingthewp-config.phpfile. Unfortunately,sincewearelockedoutofoursitebythe503error,wecan’tinstallandactivateanewplugin.So,wehavetomodifythewp-config.phpfile. Ifyou’reunfamiliarwithWP_DEBUG,checkoutourfullguidetoenablingdebugmodeinWordPress. Otherwise,youneedtoaccessyoursiteviaFTP/SFTPorSSH.Gotoyourpublic_htmlfolderandfindthewp-config.phpfile. Rightclicktoeditit,thenfindthetextthatsays“That’sall,stopediting!Happypublishing.” Justbeforethatline,addthefollowingcode: define('WP_DEBUG',true); define('WP_DEBUG_LOG',true); Finally,gobacktoyourwebsiteandrepeatthestepsthatledtotheerror.Onceyoureceivethe503erroragain,switchbacktoyourFTP/SFTPclientandopenthefileatpublic_html/wp-content/debug.log. Youshouldseealistofanyerrors,oneofwhichhopefullyindicateswhatiscausingyour503issue. 6.LimittheWordPress‘Heartbeat’API TheWordPressHeartbeatAPIcommunicateswithyourserverusingAJAX,whichallowsittodisplaysomeinformationinyourWordPressdashboardinrealtime. Forexample,itwilldisplayifapostisbeingeditedbyanotheruser,sothatyoucanavoidoverlapping. Whiletheheartbeatisuseful,it’snotessential,andsometimesitcancauseissuesbysendingtoomanyrequeststoyourserver. Normally,todisabletheheartbeat,youcaninstalltheHeartbeatControlplugin.However,ifyouhavethe503error,youwon’tbeabletoaccessyoursite’scontrolpanel. Inthiscase,you’llneedtoconnecttoyoursiteviaFTP/SFTPorSSHandfindthefunctions.phpfile.Itisinthefolderforyourtheme,whichisat​​wp-content/themes/your-theme,replacingyour-themewithyourcurrentthemename. Inthefunctions.phpfile,addthefollowingcode: add_action('init','stop_heartbeat',1); functionstop_heartbeat(){ wp_deregister_script('heartbeat'); } Thensaveandreloadyourwebsite.Istheerrorthere? Thiscodewillbeerasedwhenyouupdateyourtheme.So,onceyouregainaccesstoyoursite,werecommendcreatingachildtheme,usingtheCustomLayoutsModuleinAstraPro,orusingtheHeartbeatControlpluginwementionedearlier. 7.IncreaseServerResources Asthe503HTTPerrorisaservererror,theissueissometimessimplyalackofserverresources.Thisoftenhappensifyouareonasharedhostingplanorareusingaveryinexpensivehostingservice. Theeasysolutionhereistoupgradeyourhost.WegenerallyrecommendamanagedWordPresshost,astheycanhelpsolvemanyoftheseissuesforyou. However,youcanalsotryupgradingthePHPmemorylimitonyourWordPresswebsite.Youhavefourdifferentwaysfordoingthis,allofwhichrequireyoutoaccessyoursiteviaFTP/SFTPorSSH.Tryoneoftheoptionsbelow: Addmemory_limit=256M;tothephp.inifile.Addini_set(‘memory_limit’,’256M’);tothewp-config.phpfile.Adddefine(‘WP_MEMORY_LIMIT’,’256M’);tothewp-config.phpfile.Addphp_valuememory_limit256Mtothe.htaccessfile. 8.TemporarilyDisableYourContentDeliveryNetwork(CDN) Finally,aCDNcansometimesbetheculpritwhenitcomestotheHTTP503Error.WhileCloudFlareandotherservicesusuallypreventtheerrorfromhappening,sometimestherecanbeminorconflictsinthedatacenterthatcauseit. TrydisablingyourCDNandthenrevisitingyoursite.Ifitloadssuccessfully,getintouchwithyourCDNandtellthemabouttheissue. CanYouPreventthe503ServiceUnavailableError? Astheysay,thebestwaytosolveaproblemistoavoiditinthefirstplace!Soarethereanywaysinwhichyoucanavoiddealingwiththe503ServiceUnavailableErrortobeginwith? Therearetwoveryeasysolutionstopreventtheerror. UpgradetoaBetterHostingPlan Thesimplestwaytoavoidthe503ServiceUnavailableErroristoupgradetoabetterhostingplan(onyourcurrenthost)ortoabetterhostcompanyentirely. Manyofthecausesoftheerrorcomedowntonothavingenoughserverresourcesorissuesrelatedtoyourwebserver.So,upgradingyourhostisasimplewaytosolvethisproblem. Whenitcomestoupgradingyourwebhosting,therearetwooptions: PickabetterhostingplanonyourcurrenthostingproviderPickadifferenthostingprovideraltogether WetypicallyrecommendusingamanagedWordPresshostingplan,suchasSiteGroundorWPEngine. UseaContentDeliveryNetwork(CDN) AnotherwaytopreventtheHTTPError503erroristouseaCDNlikeCloudflare.Theseserviceswillprotectyoursiteagainstavarietyofthreats,includingtrafficoverload. Theywillalsoreducetheactualamountofbandwidththatisrequiredtodeliveryoursitetoviewers,whichlessensthepotentialforserverissues. Thisisespeciallyrelevantifyouanticipatehavingamassiveamountoftrafficinashortperiodoftime.Forinstance,ifyoursitegoesviralonRedditorTwitter. Fixingthe503HTTPServiceError:AWrap-up Errorscanbefrustratingtodealwith,especiallyifyouaren’ttechnically-inclined.However,mostofthemareactuallysimpletosolveifyouknowwhattodo. The503ServiceUnavailableerrorisacommonproblemanditlocksyououtofyourwebsite.Thankfully,fixingitisusuallyprettyeasyanddoesn’trequiremuchtimeoreffort.Justgothroughthedifferentstepswecoveredinthispost. Haveyouexperiencedthe503HTTPServiceUnavailableerror?Whatwasthecause?Andhowdidyousolveit?Shareyoursolutionsinthecommentsbelow! Join635,020Subscribers Getexclusiveaccesstonewtips,articles,guides,updates,andmore. YourfirstnameYouremailaddressSUBSCRIBE AbouttheAuthor OureditorialteamatAstraisagroupofexpertsledbytheco-founderofBrainstormForce,SujayPawar.Weaimtocreatewellresearched,highlydetailedcontentrelatedtoWordPress,Webdesign,andguidesonhowtogrowyouronlinebusiness. SharingisCaring! LeaveaCommentCancelReplyYouremailaddresswillnotbepublished.Requiredfieldsaremarked*Typehere..Name* Email* Website RecommendedArticles WhatisheadlesseCommerceandhowdoesitwork? EditorialTeam June2,2022 Fivereasonswhyyourpodcastneedsawebsite EditorialTeam May16,2022 HowtoCreateaWebsitein10EasySteps EditorialTeam May24,2022 AstraisFree.Now&Forever. Webelievecreatingbeautifulwebsitesshouldnotbeexpensive.That'swhyAstraisfreeforeveryone.Getstartedforfreeandextendwithaffordablepackages. downloadnow ScrolltoTop Nowchooseyourpreferredpagebuilderaddon UltimateAddonsforElementor UltimateAddonsforBeaverBuilder ProceedtoCheckout Chooseyourpreferredpagebuilderaddon DownloadisJustAClickAway! Enteryouremailaddressandbethefirsttolearnaboutupdatesandnewfeatures. FirstnameYourEmailSUBSCRIBE&DOWNLOAD



請為這篇文章評分?