• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Forwarded to devs [nginx] localhost can't be resolved

manuth

New Pleskian
User name: manuth

TITLE

[nginx] localhost can't be resolved

PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE

Plesk Obsidian v18.0.25_build1800200325.19 os_Ubuntu 18.04, Ubuntu 18.04.4 LTS, x86_64

PROBLEM DESCRIPTION

proxy_pass-directives to localhost won't work.

STEPS TO REPRODUCE

Create a fresh Ubuntu 18.04.4 installation
Install plesk using the One Click Setup
Create a docker-container which publishes a port.
Create a (sub-)domain with 301-redirection to https
In the nginx & Apache options disable proxy mode
Add a piece of code like this here:
NGINX:
location / {
    proxy_pass http://localhost:8080;
}

Try to access the website with said nginx-config.

ACTUAL RESULT

An error is reported:
Code:
3777#0: *622 no resolver defined to resolve localhost

After applying the fix mentioned in this thread: Websites show 502 Bad Gateway: no resolver defined to resolve example.com

Another error is reported instead:
Code:
7707#0: *627 localhost could not be resolved (3: Host not found)

EXPECTED RESULT

The requests should be passed to localhost without an error.

ANY ADDITIONAL INFORMATION

A possible workaround is to use 127.0.0.1 instead of localhost. But after trying this I found another very weird misbehavior of plesk's nginx which is covered in a separate thread.

YOUR EXPECTATIONS FROM PLESK SERVICE TEAM

Confirm bug
 
Last edited:
Thanks for the rapid answer
My /etc/hosts looks as followed:
Bash:
127.0.0.1       localhost.localdomain localhost
127.0.1.1       [censored]

# The following lines are desirable for IPv6 capable hosts
::1     localhost.localdomain localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
 
Back
Top