Question - DigitalOcean

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

GET http://localhost:5000/user net::ERR_CONNECTION_REFUSED when running ... failed (111: Connection refused) while connecting to upstream, ... × SharethisQuestion Wherewouldyouliketosharethisto? Twitter Reddit HackerNews Facebook Sharelink Questionsharelink × ShareyourQuestion Yourquestionhasbeenposted!Shareitwithotherstoincreaseitsvisibilityandtogetitansweredquickly. Wherewouldyouliketosharethisto? Twitter Sharelink Questionsharelink × Signupforournewsletter GetthelatesttutorialsonSysAdminandopensourcetopics. SignUp × Thanksforsigningup! × Replacepreviousanswer? Aquestioncanonlyhaveoneacceptedanswer.Areyousureyouwanttoreplacethecurrentanswerwiththisone? Yes,I'msure × Changedyourmind? Youpreviouslymarkedthisanswerasaccepted.Areyousureyouwanttounacceptit? Yes,I'msure DigitalOceanhome Products Pricing Docs ProductDocs APIDocs Signin Community ControlPanel Tutorials Questions TechTalks GetInvolved Hollie'sHubforGood Supportingeachothertomakeanimpact WriteforDigitalOcean Yougetpaid,wedonatetotechnon-profits. Hacktoberfest ContributetoOpenSource CommunityToolsandIntegrations HatchStartupProgram MarketplacePartnerProgram SolutionsPartnerProgram PresentationGrants DigitalOceanonGitHub SearchCommunity / SignUp Related JointheDigitalOceanCommunity Join1M+otherdevelopersand: GethelpandshareknowledgeinQ&ASubscribetotopicsofinterestGetcourses&toolsthathelpyougrowasadeveloperorsmallbusinessowner JoinNow Whyaresnapshotssoslow Question mysiteidownpleaseseehttp://www.cheri3a.com/ Question 0 Question GEThttp://localhost:5000/usernet::ERR_CONNECTION_REFUSEDwhenrunningapplication PostedAugust4,2021 2.8kviews NginxNode.jsDigitalOceanReact I’vebeenfollowinghttps://marketplace.digitalocean.com/apps/nodejs?getting-startedtutorialtohostmywebapplicationontheDroplet/IPIhave. I’vebeenabletohavethefrontendofmywebsitesuccessfullyloadhoweverthebackendwiththeHTTPrequestsarenotworking.Ikeepgettinga'GEThttp://localhost:5000/usernet::ERR_CONNECTION_REFUSED'error.I’musingReactforthefrontendandNodeforthebackend. ThisistheerrorIgetfrom/var/log/nginx/error.log: 2021/08/0403:03:58[error]20156#20156:*17connect()failed(111:Connectionrefused)whileconnectingtoupstream,client:173.72.3.10,server:workoutlabnode,request:"GET/favicon.icoHTTP/1.1",upstream:"http://127.0.0.1:3000/favicon.ico",host:"161.35.100.44",referrer:"http://161.35.100.44/login" 2021/08/0403:05:15[error]20156#20156:*65connect()failed(111:Connectionrefused)whileconnectingtoupstream,client:173.72.3.10,server:workoutlabnode,request:"GET/loginHTTP/1.1",upstream:"http://127.0.0.1:3000/login",host:"161.35.100.44" 2021/08/0403:11:08[error]20156#20156:*301connect()failed(111:Connectionrefused)whileconnectingtoupstream,client:173.72.3.10,server:workoutlabnode,request:"GET/loginHTTP/1.1",upstream:"http://127.0.0.1:3000/login",host:"161.35.100.44",referrer:"http://161.35.100.44/login" 2021/08/0403:13:11[error]20156#20156:*346connect()failed(111:Connectionrefused)whileconnectingtoupstream,client:173.72.3.10,server:workoutlabnode,request:"GET/loginHTTP/1.1",upstream:"http://127.0.0.1:3000/login",host:"161.35.100.44",referrer:"http://161.35.100.44/workout-tracker" 2021/08/0403:48:15[alert]20156#20156:*457opensocket#16leftinconnection7 2021/08/0403:48:15[alert]20156#20156:*458opensocket#15leftinconnection9 2021/08/0403:48:15[alert]20156#20156:aborting Thisismynetstat-plantoutput: ActiveInternetconnections(serversandestablished) ProtoRecv-QSend-QLocalAddressForeignAddressStatePID/Programname tcp000.0.0.0:800.0.0.0:*LISTEN22722/nginx:master tcp00127.0.0.53:530.0.0.0:*LISTEN624/systemd-resolve tcp000.0.0.0:220.0.0.0:*LISTEN975/sshd:/usr/sbin tcp000.0.0.0:30000.0.0.0:*LISTEN22644/node tcp00161.35.100.44:80173.72.3.10:59033ESTABLISHED22723/nginx:worker tcp00127.0.0.1:35252127.0.0.1:3000ESTABLISHED22723/nginx:worker tcp00127.0.0.1:3000127.0.0.1:35252ESTABLISHED22644/node tcp0340161.35.100.44:22173.72.3.10:55528ESTABLISHED16951/sshd:root@pt tcp600:::5000:::*LISTEN22688/node/root/wo tcp600:::80:::*LISTEN22722/nginx:master tcp600:::22:::*LISTEN975/sshd:/usr/sbin Thisispartofmy/etc/nginx/sites-available/defaultfile: location/{ proxy_http_version1.1; proxy_cache_bypass$http_upgrade; proxy_set_headerUpgrade$http_upgrade; proxy_set_headerConnection'upgrade'; proxy_set_headerHost$host; proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for; proxy_set_headerX-Forwarded-Proto$scheme; proxy_passhttp://localhost:3000; } location/server{ proxy_http_version1.1; proxy_cache_bypass$http_upgrade; proxy_set_headerUpgrade$http_upgrade; proxy_set_headerConnection'upgrade'; proxy_set_headerHost$host; proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for; proxy_set_headerX-Forwarded-Proto$scheme; proxy_passhttp://localhost:5000; } Thefrontendreactappissupposedtoberunningonport3000andthebackendserverisrunningonport5000. Anyhelponhowtosolvethisissuewouldbegreatlyappreciated! Addacomment Subscribe Subscribed Share Report By: sadena editedbybobbyiliev Related JointheDigitalOceanCommunity Join1M+otherdevelopersand: GethelpandshareknowledgeinQ&ASubscribetotopicsofinterestGetcourses&toolsthathelpyougrowasadeveloperorsmallbusinessowner JoinNow Whyaresnapshotssoslow Question mysiteidownpleaseseehttp://www.cheri3a.com/ Question Addacomment Leaveacomment SignIntoComment TheseanswersareprovidedbyourCommunity.Ifyoufindthemuseful,showsomelovebyclickingtheheart. Ifyourunintoissuesleaveacomment,oraddyourownanswertohelpothers. × SubmitanAnswer Submitananswer Youcantype!refinthistextareatoquicklysearchour fullsetoftutorials,documentation&marketplaceofferingsandinsertthelink! SignIntoAnswer 1answer 0 bobbyiliev August4,2021 Hithere, Yourserverconfigurationlooksgood! TheonlychangethatyouneedtomakeisforReactapptoconnecttohttp://your_ip/serverratherthanlocalhost:5000. ThatwaytheNginxproxywillforwardthetrafficfromthe/serverendpointtotheservicethatisrunningonport5000. Letmeknowhowitgoes! Regards, Bobby Reply Report 0 sadena August4,2021 WhenIchangetheReactapptomakeaaxios.getrequesttohttp://161.35.100.44/server/user/Igetahttp://161.35.100.44/server/user/404(NotFound)errorinmyconsolelog. Reply Report 0 bobbyiliev August6,2021 Hello, Icouldsuggestcheckingyourexpressserveraccesslogstoseehowexactlytherequestisbeinghandled.Atthemomentifyouvisithttps://www.workoutlab.live/server/useryouget404aswell,whichcouldmeanthateitherthe/userendpointisnotpresentorthattheNodeappisreceiving/server/userastherequestandfailstomatchitwithyour/userroute. Reply Report 0 sadena August7,2021 Hi, Thankyouforyourreply. Icheckedthepm2logsfortheserverandthereisthiserror: Error:listenEADDRINUSE:addressalreadyinuse0.0.0.0:80 atServer.setupListenHandle[as_listen2](net.js:1316:16) atlistenInCluster(net.js:1364:12) atdoListen(net.js:1501:7) atprocessTicksAndRejections(internal/process/task_queues.js:85:21){ code:'EADDRINUSE', errno:'EADDRINUSE', syscall:'listen', address:'0.0.0.0', port:80 } Icheckedwhatisrunningonport80anditis COMMANDPIDUSERFDTYPEDEVICESIZE/OFFNODENAME nginx107260root6uIPv413418400t0TCP*:http(LISTEN) nginx107261www-data6uIPv413418400t0TCP*:http(LISTEN) IfIkillthesetwoprocessesthenthefrontendofthewebsitedoesn’tworkanymoresonotsurewhattodoaboutthis.I’mrunningapm2instanceforthereactappandonefortheserver.Thenginxsites-enabled/defaultisconfiguredsothathttpisredirectedtohttps: server{ listen80; server_namewww.workoutlab.live; rewrite^/(.*)https://www.workoutlab.live/$1permanent; } server{ #SSLconfiguration # listen443ssldefault_server; Doyouhaveanyideasonhowtofixthis? Reply Report 0 bobbyiliev August8,2021 Hithere, ItlookslikethatyourNodeserviceisalsotryingtolistenonport80anditgetsinaconflictwithNginx,asNginxisalreadylisteningonthatport. Keepinmindthatyoucannothavemultipleserviceslisteningonthesameport. WhatyouneedtodoinordertofixthisistochangetheportforyourNodeservicefromport80toanotherportlike5000sothatitmatchesyourNginxconfig. Letmeknowhowitgoes! Regards, Bobby Reply Report 0 sadena August14,2021 HiBobby, IhadtochangetheendpointsinmyNodeappto/server/usersothattheroutematchestherequest.Everythingworksnow,thankyouforyourhelp! Reply Report 0 bobbyiliev August19,2021 Hithere, Noproblematall!Happytohearthatyou’vegotitallworking! Regards, Bobby Reply Report Related question Whyaresnapshotssoslow Whyaresnapshotssoslow? Ittook35minutestomakeasnapshot.andthentodeployanewdropletbasedonthatsnapshottakesalongtimeit'sbeensaying30secondsleftforagesnow. question mysiteidownpleaseseehttp://www.cheri3a.com/ YouhavereachedadomainthatwaspendingverificationperICANNrulesbuthassincebeenverified.Itmaytake24to48hoursforthewebsitetocomebackonline. https://ibb.co/e90sok pleaseanysolution icleanevreythinkcache butwheni... question Whyismydropletstuckat"creating"?ithasbeenhoursnow:( Dropletissimplystuckatcreating,Ievenopenedaticket(1252401)butthesupportistoolazytoevenreply.Whatisthisissue? question Whatwouldbethebestwaytodeployanappfor10people Ihavewrittenanappinnode.jsandVue.Thisappneedstobeusedbyabout10peoplefornow,butitmustbescalabletoatleast100users. Itwillalsousemongodbandtheenvironmentofeachuserneedstobeseparatedfromeachother. ... Lookingforsomethingelse? Askanewquestion Searchformorehelp × JointheCommunity Beforeyoucandothat Tocompletethisaction,signintoyourCommunityaccountorcreateanewone. SignIn SignUp × Tutorials Questions WriteforUs Hacktoberfest Tools Homepage Pricing ProductOverview Marketplace ControlPanel Documentation ContactSupport ContactSales SignIn



請為這篇文章評分?