Question

net::ERR_CONNECTION_REFUSED After resizing droplet

Yesterday we decided to resize our droplet. Before that, everything was running fine. Our Node/Express server was up, and we could connect to it.

After resizing it. We could no longer fetch from the server, even though the application is 100% running, I’ve checked many times, via pm2. Logs are being printed out constantly.

I’ve read countless threads and tried countless solutions, none that worked so far. Port seems fine. Firewalls are disabled.

The 2 errors we are getting are net::ERR_CONNECTION_REFUSED and TypeError: Failed to fetch.

The application runs fine on localhost, just not on the droplet. Would appreciate any help. If there’s any further information needed please let me know.

Edit: Not sure how relevant, but I ran “service nginx status” and got the following:

● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2024-01-03 21:00:38 UTC; 13h ago Docs: man:nginx(8) Process: 903 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Jan 03 21:00:37 glorious-nexus-api systemd[1]: Starting A high performance web server and a reverse proxy server… Jan 03 21:00:37 glorious-nexus-api nginx[903]: nginx: [alert] could not open error log file: open() “/var/log/nginx/error.log” failed Jan 03 21:00:38 glorious-nexus-api nginx[903]: 2024/01/03 21:00:37 [emerg] 903#903: open() “/var/log/nginx/access.log” failed (2: No Jan 03 21:00:38 glorious-nexus-api nginx[903]: nginx: configuration file /etc/nginx/nginx.conf test failed Jan 03 21:00:38 glorious-nexus-api systemd[1]: nginx.service: Control process exited, code=exited status=1 Jan 03 21:00:38 glorious-nexus-api systemd[1]: nginx.service: Failed with result ‘exit-code’. Jan 03 21:00:38 glorious-nexus-api systemd[1]: Failed to start A high performance web server and a reverse proxy server.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
January 5, 2024
Accepted Answer

Hi there,

As far as I can tell from the output, the primary issue seems to be with Nginx, as indicated by the failed status in your service nginx status command.

The logs suggest problems with accessing the log files (/var/log/nginx/error.log and /var/log/nginx/access.log). This could be due to permission issues or missing directories/files.

  • First, ensure that the /var/log/nginx/ directory exists and has the correct permissions. You can recreate it and set appropriate permissions using commands like sudo mkdir -p /var/log/nginx/ and sudo chown -R www-data:www-data /var/log/nginx/.
  • After fixing the log directory issue, try restarting Nginx with sudo systemctl restart nginx and try again.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel