0

When I upload files to my staging server (CentOS 6.5, Apache 2.2.26) - such as images or PDFs - via FTP, or by using a file upload script I created (using Laravel 4), they 404 even though they exist.

However, any files that are pulled via git are fine.

I took a look at the difference between ownership of a normally loading file and a 404ing file. When uploaded via FTP or the site, the owner:group is mobius:mobius. When pulled by git, it's 0:0.

When I run chown -R 0:0 assets/, any files that previously returned 404 loaded perfectly. However, since the site has an upload feature it would be impractical to have to keep executing this command.

How can I make the server show the file no matter who the owner? chmod won't work on its own.

I don't think it's a problem with my .htaccess because I deleted it and still got a 404.

Edit: It's worth noting that I can access the file using the absolute URL (i.e., not a subdomain)

  • Verify that it's not SELinux. – fuero Aug 7 '14 at 9:59
  • When I run sestatus I get SELinux status: disabled – Sacha Aug 7 '14 at 10:02
  • 1
    apache shows a message in the error log when there's a 404. What is the message? – Antonis Christofides Aug 7 '14 at 10:25
  • The line that is added when I try and access an image that 404s is: [Thu Aug 07 11:32:59 2014] [error] [client 91.214.231.74] Caught race condition abuser. attacker: 0, victim: 501 open file owner: 501, open file: /home/mobius/public_html/clients/munchbox/public/assets/global/pics/posts/5rXHXVT8Yyu94CG.jpg, referer: http://munchbox.mobiusdev.co.uk/ – Sacha Aug 7 '14 at 10:33
  • It's worth noting that I can access the file using the absolute URL (i.e., not a subdomain) – Sacha Aug 7 '14 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.