![]() |
Apache2 Server...File not found /htdocs
Excerpt from logs:
Code:
< [Thu Oct 04 13:38:53 2007] [error] [client 127.0.0.1] File does not exist: /htdocsCode:
myhostname# apache2 -VCode:
-D HTTPD_ROOT=""Code:
ServerRoot "/etc/apache2"Any help is much appreciated. Cheers! |
Scottley,
Just a WAG but do you have a "Document Root" directive for all of your virtual hosts? According to the Apache docs the default document root is "ServerRoot"/htdocs. Also whatever is causing the error is accessing your server through the loop-back (127.0.0.1). What's up with that? Norm |
Quote:
Quote:
ServerRoot "/etc/apache2" in Apache2.conf, but the: -D HTTPD_ROOT="" seems to be taking precedence. I can get the error to stop by creating a /htdocs directory (based off /), but this is just a hack. This /htdocs directory is the only htdocs on my system (the one that I created). |
I finally see what you are saying. The error is relative to the compiled-in ServerRoot not the ServerRoot in your config file. I tried unsuccessfully to replicate this error on a machine that I have.
Does your access log give you any clue about what is happening at the time of the error(s)? Norm |
usually the document root for apache(2) is /var/www isn't it ?
Code:
username@it-etch:~$ cd /var/www |
Yep, /var/www on most systems I think, but it can be any directory.
What Scottley is pointing out, and it took two posts for me to get it, is that the server is trying to serve files from /htdocs. In his config file the statement Code:
ServerRoot "/etc/apache2"Code:
/etc/apache2/htdocsAt least that is the way that I understand it. Could be wrong though. Norm |
I have 20 something sites hosted on this server (I'm not an apache noob, but this server was recently upgraded to apache2, which I Have less experience with). Each site has it's own DocumentRoot, ServerName, ServerAlias, and Directory directives (follow symLinks, etc).
the errors are so often and only related to the default VHost (which has a DocumentRoot of /var/www/), that I'm led to believe that it is a module, not Apache2 causing the error. I have openSSL and PHP installed on this server. The Apache 2 install that I used was through apt-get. I did not compile this myself (probably my first mistake, but it's sooo easy). I have made the errors stop by adding the directory /htdocs/, but I don't like this hack. I don't see any errors for something looking for a file in /htdocs/ (e.g. File Not Found /htdocs/<some file>). I just had a thought.... Could this File not found /htdocs/ error be some kind of security check that Apache2 (or some loaded module) looking to see if it can access files in /htdocs? This is probably a WAG, but it seems logical. A good analog to my hypothesis is in osCommerce, whenever a page is loaded, it touches /include/configure.php to see if it is protected or writeable and displays a warning bar stating that the configure.php is writeable |
Quote:
in my case, I had two ports open for apache, and the request was made to the second port for a virtual host that was only setup on the first port. Ultimately, I think this is happening because its to a Virtual host that does not exist, or to an ip address. just add a DocumentRoot=/path/to/web/files in your main apache2.conf, which will apply to all requests that don't match a configured virtual host. In debian, mine didn't have by default. I added it and it worked. In addition, if you don't want those requests to succeed, then deny all in the directory section: <Directory /path/to/web/files> deny from all </Directory> seems right that it tried /htdocs as that was the compiled default, and I'm guessing you had no other document root specified outside a vhost. |
Old thread - new for me...
I recently had the same problem when I removed iscp(free clone of cPanel).
Try to add in /etc/apache2/apache2.conf the following line: Code:
Include /etc/apache2/sites-enabled/ |
I got the same problem before. And this is why I got this complain of Apache and how I solved it.
Suppose my website is at: localhost/mywebsite/test.html The code of test.html is: Code:
<html>[Wed Nov 07 12:42:55 2012] [error] [client xxx.17.yyy.24] File does not exist: /htdocs [Wed Nov 07 12:43:06 2012] [error] [client xxx.17.yyy.24] File does not exist: /htdocs [Wed Nov 07 12:43:07 2012] [error] [client xxx.17.yyy.24] File does not exist: /htdocs So, how can I fix this? The key is: favicon.ico Insert one more line into my code website: Code:
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon" />Code:
<html>Now, try to open website again, I don't get the stupid error from Apache anymore. I hope this helps you guys somehow. Good luck. Simon. |
I too was suffering this problem with a new install on a Debian box. I don't do Apache setups on a regular basis so I always end up suffering with details such as this. In my case I guessed the host was not able to resolve the host name I was using in the <VirtualHost hostname:8081> tag. When I added the fully qualified hostname to my /etc/hosts file and restarted Apache it started to work. Perhaps this will help someone else.
In my case I was just throwing something together quickly so perhaps this is not preferred method. For example, I'm doing stuff with NAT'd IPs, various hosts, multiple sites so I have not resolved how I plan to leverage DNS in all of this yet. (Pun intended!) |
I apologize for a less than accurate response above, but the site was blocking me from using the fully qualified name in my post. It thought I was trying to link to another site so I was forced to use the word hostname where I otherwise would have had the actual fully qualified host.domainname syntax.
|
| All times are GMT -5. The time now is 02:45 PM. |