1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

DNS confusion in /etc/hosts

Discussion in 'Plesk for Linux - 8.x and Older' started by rjshelq, Sep 17, 2007.

  1. rjshelq

    rjshelq New Pleskian

    Sep 17, 2007
    Likes Received:

    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: mydomain.com domain localhost.localdomain localhost


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

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

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

    .... thanks....
  2. phoenixisp

    phoenixisp Silver Pleskian

    Feb 2, 2002
    Likes Received:
    Your /etc/hosts file should look like this: 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.