Owen Delisle
Owen Delisle

Reputation: 49

502 Bad Gateway nginx/1.14.0 (Ubuntu) Error

I recently made a droplet using Ubuntu and Docker with Nginx. I deployed my prisma react native project to the droplet and everything was working fine.

I shut down my droplet using sudo shutdown -r now and when the droplet rebooted instead of the droplet ip address showing Graphql Playground I now see 502 Bad Gateway nginx/1.14.0 (Ubuntu)

running the command sudo tail -5 /var/log/nginx/error.log shows the error

2019/03/27 17:17:44 [error] 10099#10099: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 172.218.13.88, server: _, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:4000/", host: "68.183.202.55"

I checked the Nginx status using sudo systemctl status nginx and everything seems to be working fine except there is a line that says nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument. I'm not sure if that's important.

Upvotes: 0

Views: 5531

Answers (1)

Oliver
Oliver

Reputation: 12981

Nginx is running just fine but it can't connect to the upstream server on port 4000 any longer (your GraphQL server).

Make sure that your GraphQL backend is set up properly with an init file and that it starts up when the droplet boots.

Upvotes: 0

Related Questions