• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Can no longer connect to nginx from localhost

Wade

New Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
18.0.57.3
At a semi-random time yesterday - possibly coinciding with a Plesk or Ubuntu update (apt full-upgrade) - my Plesk-operated web server became unreachable from localhost. This broke a cron job that was using Plesk's fetch_url against mydomain.com.

Ultimately I've narrowed it down to one of two problems, but I'm not sure which is "the" problem and thus which one to try to fix:
  1. /etc/hosts has an entry for mydomain.com redirecting to 127.0.1.1.
  2. Nginx is configured to listen only on the external IP address, not all interfaces.
Thus when I run e.g. curl https://mydomain.com from my server, it tries connecting to 127.0.1.1 instead of the public IP address, and Nginx is not listening on localhost, so I get a connection refused error.

I found various earlier forum threads about this issue (e.g. Can't access sites from localhost) but none have any resolution.

I also don't understand why this only just broke yesterday - it was working just fine before that. Alas I don't know what the relevant config files contained prior to this breakage.

As a workaround for the cron job, I was able to rewrite it as curl --header 'Host: mydomain.com' https://<external IP>, which is fine, I guess, although it'd be nice not to have to hard-code my external IP address into a random cron job (in case it changes in future - there's no way I'll remember to update this cron job).
 
Back
Top