Apache 503 error - Here's how we nailed it - Bobcares
文章推薦指數: 80 %
A 503 service unavailable error simply means that the server was temporarily unable to handle the request for the website. And, at other times ... Needhelp?Ourexpertshavehadanaverageresponsetimeof12.46minutesinApril2022tofixurgentissues.GETHELPRIGHTNOWWewillkeepyourserversstable,secure,andfastatalltimesforonefixedprice.SEESUPPORTPLANSApache503error–Here’showwenaileditbySijinGeorge|Mar30,2019Websiteerrorsalwaysshatteryourpeaceofmind.Especially,whenyouhavenoclueonwhatcausesit.AtypicalexampleisApache503erroronyourwebsite.Unfortunately,thewebserverjustsaysitas“serviceunavailable.”But,thetrickypartisfindingtherealreasonthatmadeserviceunavailable.That’swhy,weoftengetrequestsfromcustomerstosolveApache503errorsaspartofourTechnicalSupportServices.Today,we’llseehowBobcares’EngineerssolvedApache503errorforourcustomer. MoreAboutApache503serviceunavailableerrorFirstly,letstrytounderstandtheimportantthingsonApache503error.A503serviceunavailableerrorsimplymeansthattheserverwastemporarilyunabletohandletherequestforthewebsite.And,atothertimesitworksperfectly.Therefore,inApache,thishappenswhenthereistemporaryoverloading.Or,itcanbeaproblemwiththeapplicationsthatprocesswebsitedata.Forexample,inPHPbasedwebsites,whensiterequestsexceedPHPtimeouts,memorylimits,etc.itshowsthe503error.Similarly,itcanhappenwhenApachewebserverisincapableofhandlingwebsiterequeststoo.Thus,theunderlyingreasoncanvarydependingontheactualserversetup.And,that’swhereourserveradministrationexperiencehelps. BackgroundoftheApache503errorNow,itstimetogetsomebackgroundinformationabouttherecentrequesttofixApache503error.MywebsiterunsonaVirtualminsystemwhichhosts6websites.5ofthemrunflawless.The6thwebsite(xxx.com)experiencesregulartimeouts(Error503ServiceUnavailable).Canyoufixitplease?Thatwastheexactrequestfromourcustomer.And,theerrorshowedupasbelow.WhenourDedicatedEngineerschecked,wecouldseethattheserverwasalreadypatched.IthadApache’sprocessingmodulesetasPrefork. Also,PHP5.xwasrunninginFastCGImode.Also,weconfirmedthattheserverhadenoughfreeresourcestosupportallthewebsites.Additionally,theApache503erroronthewebsitewasintermittent.Mostly,areloadinthebrowsermadethewebsiteworkingagain. HowwefixedApache503errorNow,we’llseehowourSupportEngineersfoundtherealreasonfortheserviceunavailableerrorandfixedit.Thisinvolvedmultiplestepsandlet’sseeeachofthemindetail. 1.CheckinglogsAsalways,webeganbycheckingthelogs.TheerrorwasApacherelated.Obviously,therightplacewastochecktheApachelogfilesat/usr/local/apache/logs.Wesearchedtheapacheaccessanderrorlogswiththeproblemdomainname.And,wecouldseedetailederrorsrelatedtothewebsiteuserinthelogsas:[WedMar1307:37:32.4730962019][fcgid:warn][pid14628][client40.xx.xx.103:5181]mod_fcgid:can'tapplyprocessslotfor/home/abc/fcgi-bin/php5.fcgiAdditionally,thelogswereshowingthesemessages:[ThuMar2107:02:23.0563382019][fcgid:warn][pid24842]mod_fcgid:process10087gracefulkillfail,sendingSIGKILL [ThuMar2107:02:23.0563532019][fcgid:warn][pid24842]mod_fcgid:process10083gracefulkillfail,sendingSIGKILL 2.TweakingPHPFCGIparametersLuckily,inthiscasethelogsgaveenoughhintsabouttheunderlyingcauseoftheApache503error.Firstly,webeganwithtweakingtheFCGIparametersofthewebsite. Insimpleterms,FastCGIisamethodforconnectinginteractiveprogramswithaApachewebserver.ApacheallowssettingFastcgilimitsforeachwebsite.Therefore,weincreasedtheparameter“FcgidMaxRequestsPerProcess”valueto500.Additionally,wetweakedrelatedFastCGIparameterstoo.And,thefinalconfigurationfileforthewebsitelookedasshownbelow.IdleTimeout3600 ProcessLifeTime7200 IPCConnectTimeout8 IPCCommTimeout600 BusyTimeout300 MaxRequestLen15728640 FcgidMaxRequestsPerProcess500 Again,thesevaluesdependontheamountofserverresourcesavailableforApache.Withawebserverrestart,wecouldsolvethe503errorandmakethewebsiteworking.However,sincetheissuewasintermittent,wekeptonmonitoringthewebsite.Forthis,ourDedicatedEngineersconfiguredautomaticalertstoo.Thus,ithelpsustochecktheserveratthetimeoferror. 3.TweakingApacheThewebsitewasworkingagain.But,thatwasnotenough.Wewantedtogiveacompletesolutiontothecustomer.TheserverlogsshowedperformanceissuesinApache.And,that’swhy,wesuggestedcustomertochangetheMultiProcessingModule(MPM)oftheApacheservertoo.ThesolutionwastoswitchApacheMPMfromPreforktoWorker.PreforkisalessefficientMPM.But,thechangeinMPMisamajorwebserverconfigurationchange,andremovesApachefromowningPHPrequests.Instead,itneedsaseparateservicenamedFPMtohandlePHP.Unfortunately,thesechangescomewithariskofwebsiteapplicationfailingtoworkproperlywithnewapacheenvironmentof“worker”.Therefore,wescheduledtheApachechangeinawaythattherewasenoughtimetoplanthingsahead.Wemadecustomercheckwiththewebsitedevelopersofeachwebsiteaboutthechangeintheserverenvironment.Finally,ourSupportEngineersproceededwiththetasktochangeApacheMPMtoworkeratoffpeakhours.Thus,wecouldminimizethebusinessimpactonthewebsites.Luckily,thechangedidnottakemuchtimeandsitesstartedloadingfine. 4.MonitoringWebsitesDoingmajorchangesontheApachewebservercanhaveimpactonwebsites.That’swherewebsitemonitoringhelps.OurDedicatedEngineerskepttheserveronourwatchlistandensuredthattheserverisperforminguptothemark.Thisinvolvesmonitoringtheserverresources,Apachememoryusage,etc.onthepeakhoursaswell.Additionally,wealwaysdoloadtestingonApacheserverstoforeseetheserverperformancewellinadvance.[IsyourApachewebsitesshowingup503errors?Wecanfixitforyou.] ConclusionInshort,Apache503errorhappensmainlywhenthereareproblemsatthewebserversettings.But,as503erroroccursintermittently,thefixcanbetricky.Today,wesawhowourSupportEngineersnaileddowntheexactreasonforApache503errorandfixeditforacustomerinproductionserver.Relatedposts:HowtoincreaseswapspaceinLinuxRedhat?OpenVPNServerchangeIPaddress–Here’sthequickwaytodoit“Cannotresolvehostaddress”inOpenVPN–Here’showtofixitPfsense–BestpracticesforenhancingsecurityPREVENTYOURSERVERFROMCRASHING!Neveragainlosecustomerstopoorserverspeed!Letushelpyou.Ourserverexpertswillmonitor&maintainyourserver24/7sothatitremainslightningfastandsecure.GETSTARTEDvargoogle_conversion_label="owonCMyG5nEQ0aD71QM";2CommentsMichelon2020-07-07at03:37Mightbeinterestingtomentionthebiggestmistakefirst.ReplySijinGeorgeon2020-07-15at13:10HelloMichel,Yes,Apachesettingscanbeareasonfortheproblemtoo.ReplySubmitaCommentCancelreplyYouremailaddresswillnotbepublished.Requiredfieldsaremarked*Comment*Name*Email*SubmitCommentΔSearchfor:Spendtimeonyourbusiness,notonyourservers.TALKTOUSOrclickheretolearnmore.RelatedPostsHowtoincreaseswapspaceinLinuxRedhat?OpenVPNServerchangeIPaddress–Here’sthequickwaytodoit“Cannotresolvehostaddress”inOpenVPN–Here’showtofixitPfsense–BestpracticesforenhancingsecurityCategoriesLatest|ServerAdministrationTags503ServiceUnavailable|ApacheerrorBobcaresusescookies.PrivacyPreferencesIAgreeOptionsConsentManagementCookieSettingsNecessaryStatisticsMarketingSecurityPrivacyPolicyWhenyouvisitanywebsite,itmaystoreorretrieveinformationonyourbrowser,mostlyintheformofcookies.Thisinformationmightbeaboutyou,yourpreferencesoryourdeviceandismostlyusedtomakethesiteworkasyouexpectitto.Theinformationdoesnotusuallydirectlyidentifyyou,butitcangiveyouamorepersonalizedwebexperience.Becausewerespectyourrighttoprivacy,youcanchoosenottoallowsometypesofcookies.Clickonthedifferentcategoryheadingstofindoutmoreandchangeourdefaultsettings.However,blockingsometypesofcookiesmayimpactyourexperienceofthesiteandtheservicesweareabletooffer.PrivacyPolicyRequiredByusingthissite,youagreetoourPrivacyPolicy.Necessarycookieshelpmakeawebsiteusablebyenablingbasicfunctionslikepagenavigationandaccesstosecureareasofthewebsite.Thewebsitecannotfunctionproperlywithoutthesecookies.PHPSESSID-Preservesusersessionstateacrosspagerequests.gdpr[consent_types]-Usedtostoreuserconsents.gdpr[allowed_cookies]-Usedtostoreuserallowedcookies.CookiesUsedRequiredPHPSESSID,gdpr[consent_types],gdpr[allowed_cookies]livechat.bobcares.comOptOutPHPSESSIDmy.bobcares.comOptOutWHMCSpKDlPzh2chMLStatisticcookieshelpwebsiteownerstounderstandhowvisitorsinteractwithwebsitesbycollectingandreportinginformationanonymously._ga-Preservesusersessionstateacrosspagerequests._gat-UsedbyGoogleAnalyticstothrottlerequestrate_gid-RegistersauniqueIDthatisusedtogeneratestatisticaldataonhowyouusethewebsite.smartlookCookie-UsedtocollectuserdeviceandlocationinformationofthesitevisitorstoimprovethewebsitesUserExperience.CookiesUsedONOFF_ga,_gat,_gidgoogle.comOptOut_ga,_gat,_gidmanager.smartlook.comOptOutsmartlookCookieMarketingcookiesareusedtotrackvisitorsacrosswebsites.Theintentionistodisplayadsthatarerelevantandengagingfortheindividualuserandtherebymorevaluableforpublishersandthirdpartyadvertisers.IDE-UsedbyGoogleDoubleClicktoregisterandreportthewebsiteuser'sactionsafterviewingorclickingoneoftheadvertiser'sadswiththepurposeofmeasuringtheefficacyofanadandtopresenttargetedadstotheuser.test_cookie-Usedtocheckiftheuser'sbrowsersupportscookies.1P_JAR-Googlecookie.Thesecookiesareusedtocollectwebsitestatisticsandtrackconversionrates.NID-RegistersauniqueIDthatidentifiesareturninguser'sdevice.TheIDisusedforservingadsthataremostrelevanttotheuser.DV-GoogleadpersonalisationCookiesUsedONOFFIDE,test_cookie,1P_JAR,NID,DV,NIDdoubleclick.netOptOutIDE,test_cookiegoogle.co.inOptOut1P_JAR,NID,DVgoogle.comOptOutNIDolark.comOptOuthblidTheseareessentialsitecookies,usedbythegooglereCAPTCHA.Thesecookiesuseanuniqueidentifiertoverifyifavisitorishumanorabot.CookiesUsedONOFFSID,APISID,HSID,NID,PREFgoogle.comOptOutSID,APISID,HSID,NID,PREF
延伸文章資訊
- 1Error 503 returned by applications that use Tomcat (e.g. ...
The "503 error" usually indicates that Tomcat is not running or that it experienced a class error...
- 2Tomcat server return 503 error Service Unavailable - Bitnami ...
The server is temporarily unable to service your request due to maintenance downtime or capacity ...
- 3Apache 503 error - Here's how we nailed it - Bobcares
A 503 service unavailable error simply means that the server was temporarily unable to handle the...
- 4Create a 503 Status Code for your Site - InMotion Hosting
- 5503 Service Unavailable - HTTP - MDN Web Docs - Mozilla