Hosts file entries for multiple domains on VPS?

40,467

Found the answer after much Googling. See edit above.

Share:
40,467

Related videos on Youtube

markratledge
Author by

markratledge

Updated on September 17, 2022

Comments

  • markratledge
    markratledge over 1 year

    mydomain is the main domain (in Plesk, Media Temple MT VPS), and under that are several Wordpress sites, like mysite1.com, mysite2.com, etc.

    Problem is that I get lots of these errors in httpd's error_log:

    [error] [client 127.0.0.1] script '/var/www/html/wp-cron.php' not found or unable to stat

    wp-cron.php does exist at the html root in all the Wordpress installs.

    I've found hints elsewhere that these errors may have something to do with my /etc/hosts file. This is the hosts file:

    127.0.0.1 mydomain.com mydomain localhost localhost.localdomain

    Question: do I need to add mysite1.com, mysite2.com, etc., to the hosts file so they resolve and can find the wp-cron.php file?

    Edit: found the answer after much Googling. Seems that there are two issues: the hosts file and the fact that MT VPS overwrite the hosts file on each reboot. So the hosts file should look like this for multiple domains on one server:

    127.0.0.1 localhost localhost.localdomain
    xxx.xxx.xxx.xxx  yourdomain1.com yourdomain1 yourdomain2.com yourdomain2
    

    And those lines must have a few blank lines above the in the hosts file, or they will get overwritten each reboot. See http://bradt.ca/archives/fix-wordpress-missed-schedule-error-on-media-temple-dv-plesk/