Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I get many of these errors each day in my apache error log:

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

and I'm wondering if it has something to with my httpd.conf, because my DocumentRoot is set as "/var/www/html" but my WordPress site(s) are in a top directory called httpdocs, not html. wp-cron.php exists, but it's in httpdocs, not html, and there is no html directory. There are multiple WordPress sites and domains on the VPS and at the IP.

There are no other errors like that in the logs, and WordPress seems to run fine. But I want to fix these errors, as it's a bit of an extra load on the server.

Is there a way to add a redirect or alias in httpd.conf so wp-cron.php can be found? Or this a different matter with a different solution?

Edit: Found the answer; problem was hosts file entries: http://serverfault.com/questions/185954/hosts-file-entries-for-multiple-domains-on-vps

share|improve this question
add comment

2 Answers

The DocumentRoot in httpd.conf is likely to be the default for any hosts not handled by a virtual host. For example, requests on the IP address.
You could set the DocumentRoot to be the same as the default site (if that's what you want for requests to the IP address), or you use a RewriteRule to rewrite the request back to the main site either in the httpd.conf or in the .htaccess file:
<Directory /var/www/html>
RewriteRule wp-cron.php http://yourdomainname.com/wp-cron.php [R=301]
</Directory>

Without knowing what the script is, or if it exists elsewhere, it's not easy to advise. A symlink could also fix it, but permissions might get in your way.

share|improve this answer
    
That makes sense. The file does exist, except it's in httpdocs, not html. And there are multiple installs of Wordpress under different domains, so I think they are all calling wp-cron.php at different times. So should I add that 301 redirect to each .htaccess in each Wordpress directory? –  songdogtech Sep 22 '10 at 20:03
    
It would be more useful to determine why it's being called every day, and then fix the source. However, if you can't do that, just a 301 redirect in the /var/www/html should suffice. –  James Lawrie Sep 23 '10 at 11:42
    
It's Wordpress; that cron call happens at least every few hours. But I don't have a html directory, so I suppose I could make one and put a 301 redirect there in an .htaccess file? –  songdogtech Sep 27 '10 at 20:49
    
If you don't have a /var/www/html, you need to fix your default documentroot so it's not pointing there. –  James Lawrie Sep 28 '10 at 8:47
    
Little hesitant to change the doc root and possibly take everything down. What should my etc/hosts file look like? There are multiple sites on the one IP, and the main site in particular isn't listed in hosts. –  songdogtech Sep 28 '10 at 22:50
add comment
up vote 1 down vote accepted

Found the answer; problem was hosts entries: http://serverfault.com/questions/185954/hosts-file-entries-for-multiple-domains-on-vps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.