• 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

DNS confusion in /etc/hosts

rjshelq

New Pleskian
Hi,

I've just moved my web site to a new server running Plesk 8.2 / CentOS 4.5, and have been having problems with dns.

The Problem:

For example, if I log in via ssh and try to use wget to grab a file from my cgi-bin, such as:

wget mydomain.com/cgi-bin/test.pl

the request fails, and according to the error logs the request has ended up going to /var/www/cgi-bin rather than the intended /var/www/vhosts/mydomain.com/cgi-bin.

Similarly, in php4 using curl or fopen to access mydomain.com/cgi-bin/test.pl always fails, and again always ends up at /var/www/cgi-bin.

In all of these cases, using the IP address rather than the domain name works fine. So, it appears that this is a dns resolution issue.

An Observation:

On this new server, the /etc/hosts file says:

127.0.0.1 mydomain.com domain localhost.localdomain localhost

Questions:

1) Why does 127.0.0.1 end up going to /var/www ? Is that by design?

2) Is it reasonable to simply change the /etc/hosts file to read:

127.0.0.1 localhost.localdomain localhost

and allow the dns to resolve mydomain.com? or does some Plesk feature require mydomain.com to resolve to 127.0.0.1?

.... thanks....
 
Your /etc/hosts file should look like this:

127.0.0.1 localhost.localdomain localhost
xxx.xxx.xxx.xxx server1.domain.com server1

Of course, change the x's to your base IP address and server1.domain.com to your server's actual hostname. That should take care of it.
 
Back
Top