• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

Apache: file not found, but it exists

I've setup a virtual host in apache using the following in my httpd.conf file

<VirtualHost *:80>
      ServerName mydomain.com
      ServerAlias www.mydomain.com mydomain.com *.mydomain.com
      DocumentRoot "/var/www/hosts/mydomain.com"
</VirtualHost>

I've put an index file in the root of the site, which I can access in a browser perfectly fine.

I then uploaded a site to the folder but it's having problems finding files that are within folders.

So I uploaded an index.html file into an empty folder, and I'm getting file not found on that as well.

if I root into the server and use vi to create an index.html file inside a folder, then it's accessible in the browser. From this I thought it might have been a permissions issue, but I changed permissions to 777 on all files and folders, that didn't work, so I changed the owner and group to apache:apache, and still, the files are not accessible in a browser.

So, why is it that when I create a file as root, it works, but if I upload one via FTP, it doesn't? even if I change the owner and permissions?
0
SheppardDigital
Asked:
SheppardDigital
  • 6
  • 5
1 Solution
 
Christopher Raymond MendozaCommented:
What distro are you using? Can you post the result of 'ls -l' from the folder uploaded via FTP please.
0
 
SheppardDigitalAuthor Commented:
An update.

I've uploaded files to a folder with a different name and they seem to work fine.
0
 
SheppardDigitalAuthor Commented:
It's centos 6

drwxr-xr-x 3 deskdrawer_ftp deskdrawer_ftp 4096 Oct 12 09:37 application
drwxr-xr-x 5 deskdrawer_ftp deskdrawer_ftp 4096 Oct 12 09:37 controller
drwxrwxrwx 4 apache         deskdrawer_ftp 4096 Oct 12 07:30 data
drwxr-xr-x 3 deskdrawer_ftp deskdrawer_ftp 4096 Oct 12 09:37 error
drwxr-xr-x 2 deskdrawer_ftp deskdrawer_ftp 4096 Oct 12 09:37 log
drwxr-xr-x 3 deskdrawer_ftp deskdrawer_ftp 4096 Oct 12 09:37 model
drwxr-xr-x 6 deskdrawer_ftp deskdrawer_ftp 4096 Oct 12 09:38 resources
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SheppardDigitalAuthor Commented:
If I rename the 'error' folder and call it something else, it seems to work fine.
0
 
Christopher Raymond MendozaCommented:
Is selinux enabled? How about the result of 'ls -l --lcontext'?
0
 
SheppardDigitalAuthor Commented:
I'm pretty sure selinux is disabled, is there an easy way to test?

drwxr-xr-x 3 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:37 application
drwxr-xr-x 5 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:37 controller
drwxrwxrwx 4 ?                                apache         deskdrawer_ftp  4096 Oct 12 07:30 data
-rw-r--r-- 1 ?                                deskdrawer_ftp deskdrawer_ftp  3839 Oct 12 09:40 deskdraw_masterdb.sql
-rw-r--r-- 1 ?                                deskdrawer_ftp deskdrawer_ftp  8938 Oct 12 09:40 deskdraw_slave1.sql
drwxr-xr-x 3 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:37 error
-rw-r--r-- 1 ?                                deskdrawer_ftp deskdrawer_ftp   458 Oct 12 09:40 error.php
-rw-r--r-- 1 ?                                deskdrawer_ftp deskdrawer_ftp  1984 Oct 12 09:40 index.php
drwxr-xr-x 2 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:37 log
drwxr-xr-x 3 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:37 model
drwxr-xr-x 6 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:38 resources
-rw-r--r-- 1 ?                                deskdrawer_ftp deskdrawer_ftp 17925 Oct 12 09:40 template.html
drwxr-xr-x 5 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:39 templates
drwxr-xr-x 5 ?                                deskdrawer_ftp deskdrawer_ftp  4096 Oct 12 09:39 view
0
 
Christopher Raymond MendozaCommented:
Yes, it seems to be turned off. You can use the command 'sestatus' to check.

Did I understand you right, you renamed the folder? You did not create another folder before deleting the old one?
0
 
SheppardDigitalAuthor Commented:
Yep,

in my ftp client, I uploaded the error folder, I tried to access it in the browser and I got file not found, in ftp again I renamed the folder to error_old, and suddenly the file is accessible in my browser.
0
 
Christopher Raymond MendozaCommented:
Same result when renaming via terminal i assume?
0
 
SheppardDigitalAuthor Commented:
Yep, same result in terminal.

It's as if apache just doesn't like the folder name 'error'
0
 
Christopher Raymond MendozaCommented:
Well, that's new. I'll make sure to remember that too.

Good luck on your project.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now