Score:1

AH01114: HTTP: failed to make connection to backend: localhost

zm flag

I know some of you might think that its a little bit off topic here, but am not sure whether its fault of server OR fault of my config file, so...

I made React.js project , but it needs server side rendering, So now I have to migrate from CRA to next.js . the problem: I have to upload my website on apache web server, from what I gathered from google, I need installed node.js and pm2 (latest versions), also configured apache for reverse proxy. I also created ecoystem for pm2(I guess it was necessary). it looks like this at the moment:


module.exports = {
  apps : [{
    name: "nextjs-app",
    script: "npm",
    args: "run build",
    env: {
      NODE_ENV: "production"
    }
  }]
};

but when I ran pm2 start npm -- start , terminal is giving me respone like this:

pm2 start npm -- start
[PM2] Spawning PM2 daemon with pm2_home=/home/georgianar/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /usr/local/bin/npm in fork_mode (1 instance)
[PM2] Done.

but when I try to see list of process, there is none, and when user tries to enter the website, site log shows that there is no service on port 3000

AH01114: HTTP: failed to make connection to backend: localhost

and

(111)Connection refused: AH00957: http: attempt to connect to 127.0.0.1:3000 (localhost:3000) failed

so, am not sure its fault of server or its my config file causing this chaos. any ideas?

Score:1
mt flag

First make sure the following commands exists in your package.json

"scripts": {
    "start": "next start -p 3000"
  }

Use the following command

pm2 start yarn --name "nextjs-app" --interpreter bash -- start

You can print out detail process information using

pm2 show nextjs-app

Configure PM2 to Start on Server Boot, run the below command as root

pm2 startup

Save the pm2 process list to relaunch them after a server reboot

pm2 save
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.