Symptoms
-
Unable to
cURL
the example.com website hosted on Plesk from the server itself:curl -vv https://example.com
* Rebuilt URL to: https://example.com/
* Trying 203.0.113.2...
* TCP_NODELAY set
* connect to 203.0.113.2 port 443 failed: Connection refused
* Failed to connect to example.com port 443: Connection refused
* Closing connection 0
curl: (7) Failed to connect to example.com port 443: Connection refused -
cURL
is accessing example.com successfully when running it from a different location. -
This domain is bound to an IP address in
/etc/hosts
file:127.0.0.1 localhost.localdomain localhost
203.0.113.2 example.com - There is a different IP assigned to this domain in Domains > example.com > Web Hosting Access
Cause
This behavior is expected because nginx on Plesk is serving the hosted domains from the IP address set in Domains > example.com > Web Hosting Access instead of the one set in /etc/hosts
file.
Resolution
-
Connect to the server via SSH.
-
Remove or comment out the line
203.0.113.2 example.com
in/etc/hosts
or use custom configuration templates to make nginx listen on all IP addresses.
Note: custom configuration templates will affect all the websites on the server.