wget not working with domain on local machine

Posted by user568829 on Server Fault See other posts from Server Fault or by user568829
Published on 2012-09-11T19:51:57Z Indexed on 2012/09/12 3:40 UTC
Read the original article Hit count: 566

Filed under:
|
|

Basically - I have some PHP scripts that need to be run as cron jobs.

Lets say the script needing to be run is: http://admin.somedomain.com/cron_jobs/get_stats

If I run the script from the local machine it gives me a 404 Not Found error.

So I entered the following into /etc/hosts

XX.XX.XX.45    admin.somedomain.com

Now wget works fine from the local machine to that domain. However when I restart Apache that domain no longer works. Here is the config for that site in /etc/apache2/sites-available

NameVirtualHost XX.XX.XX.45:80

<VirtualHost XX.XX.XX.45:80>
    ServerName admin.somedomain.com
     DocumentRoot /var/www/admin.somedomain.com/
    <Directory "/var/www/admin.somedomain.com">
            allowoverride all
          Options Indexes
          order deny,allow
           allow from all
       </Directory>
    ErrorLog /var/log/apache2/admin.somedomain.com-error_log
    CustomLog /var/log/apache2/admin.somedomain.com-access_log combined

</VirtualHost>

It just goes to the default site config showing "It Works".

If I take out that setting in /etc/hosts and restart apache the website at that domain works fine again.

Can anyone point me in the right direction here? Thanks

© Server Fault or respective owner

Related posts about dns

Related posts about hosts