Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I have been asked to help a colleague with a web application hosted on a digital ocean droplet. The application was initially created and maintained by someone who is no longer contactable, no one really knows what the application was written in, but they now need to make some changes and would like to be able to connect to the database.
After speaking with support at digital ocean they advised me I needed to reset the root password (it was unknown) I did that this morning but now the website is offline with a gateway 502 error.
If I try to load the webpage, I get this error in the logs.
2022/09/04 21:46:48 [error] 8165#8165: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 51.241.69.5, server: antifungalinteractions.org, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "antifungalinteractions.org"
If I check the status of nginx,
root@adi:/# sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-09-04 21:16:56 UTC; 33min ago
Process: 8144 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 8160 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 8157 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 8164 (nginx)
Tasks: 2
Memory: 1.9M
CPU: 73ms
CGroup: /system.slice/nginx.service
├─8164 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─8165 nginx: worker process
Sep 04 21:16:56 adi systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 04 21:16:56 adi systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Sep 04 21:16:56 adi systemd[1]: Started A high performance web server and a reverse proxy server.
Here I see an error regarding parsing the PID file, from some research it suggests this is a common bug caused by the systmd trying to read the file before nginx created it, and suggests the follow (which I have not done yet, as I am a total noob with this and dont want to break anything.)
Step 1. Create the directory /etc/systemd/system/nginx.service.d Create a directory named nginx.service.d in /etc/systemd/system/:
mkdir /etc/systemd/system/nginx.service.d Should the system complain that it already exists, ignore and move on to Step 2.
Step 2. Print data to file Execute:
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
This is a one-liner. printf will write its output into the configuration file /etc/systemd/system/nginx.service.d/override.conf.
Step 3. Reload the daemon Reload systemd manager configuration:
systemctl daemon-reload This will rerun all generators, reload all unit files and recreate the entire systemd dependency tree.
Step 4. Restart NGINX This line will restart NGINX for you:
systemctl restart nginx The error should be fixed now. Any help or suggestions on how to get the website back up and running?
Thanks
ebeecroft
Noor Bakkal
384d3f11289345379905a243f7b817
IsaacMvd
Ervan Agus
Teckno
dc1bce8262314f84b368813178d9e4
gerard
gerard
Stan Flint