LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 10-05-2007, 12:45 PM   #1
scottley
LQ Newbie
 
Registered: Oct 2006
Distribution: Debian (server) FC6 (Laptop)
Posts: 6

Rep: Reputation: 0
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: /htdocs
< [Thu Oct 04 13:38:54 2007] [error] [client 127.0.0.1] File does not exist: /htdocs
< [Thu Oct 04 13:38:55 2007] [error] [client 127.0.0.1] File does not exist: /htdocs
< [Thu Oct 04 13:39:33 2007] [error] [client 127.0.0.1] File does not exist: /htdocs
this happens quite frequently and persists throughout the day. Google searches for this error show that there "should" be something wrong in my apache2.conf. I have no references to /htdocs in my conf, but this one strange output makes me think that this may be an apache2 default:

Code:
myhostname# apache2 -V
Server version: Apache/2.2.3
Server built:   Jun 17 2007 20:24:06
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
note the
Code:
-D HTTPD_ROOT=""
do I need to explicitly set an httpd root in the apache2.conf or is this handled in a virtual hosts entry. I'm working on a web server with over 20 sites on it, so each virtual host is given it's own DocumenRoot and I thought the
Code:
ServerRoot "/etc/apache2"
would point HTTPD_ROOT to something (this is the default from the install, i did not change it)

Any help is much appreciated.
Cheers!
 
Old 10-07-2007, 01:26 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 237

Rep: Reputation: 44
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
 
Old 10-08-2007, 12:13 PM   #3
scottley
LQ Newbie
 
Registered: Oct 2006
Distribution: Debian (server) FC6 (Laptop)
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Also whatever is causing the error is accessing your server through the loop-back (127.0.0.1). What's up with that?
It seems to be that if you don't assign a specific IP to apache it does it's thing through the loopback.
Quote:
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.
I have a DocumentRoot for each of my VHosts, yes. my ServerRoot is set to:
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).

Last edited by scottley; 10-08-2007 at 01:01 PM.
 
Old 10-09-2007, 07:57 AM   #4
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 237

Rep: Reputation: 44
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
 
Old 10-09-2007, 03:08 PM   #5
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,228
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
usually the document root for apache(2) is /var/www isn't it ?

Code:
username@it-etch:~$ cd /var/www
username@it-etch:/var/www$ ls
apache2-default

username@it-etch:/var/www$ ls apache2-default
apache_pb22_ani.gif  apache_pb22.png  apache_pb.png
apache_pb22.gif      apache_pb.gif    index.html
at least on most systems I have worked on..

Last edited by farslayer; 10-09-2007 at 03:11 PM.
 
Old 10-09-2007, 05:42 PM   #6
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 237

Rep: Reputation: 44
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"
should tell the server to look in
Code:
/etc/apache2/htdocs
and this would only be the default case i.e. a virtual host with no DocumentRoot statement.

At least that is the way that I understand it. Could be wrong though.

Norm
 
Old 10-09-2007, 08:21 PM   #7
scottley
LQ Newbie
 
Registered: Oct 2006
Distribution: Debian (server) FC6 (Laptop)
Posts: 6

Original Poster
Rep: Reputation: 0
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
 
Old 06-19-2009, 04:17 PM   #8
Uther Pendragon
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by scottley View Post
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
I had this problem too, turned out the request was to a virtual host that didn't exist...

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 08-11-2010, 10:31 AM   #9
kamiltux
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
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/
Include /etc/apache2/sites-available/
Reinstallation of Apache did not help for me.
 
Old 11-07-2012, 01:35 PM   #10
SimonKing
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
Thumbs up

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>
<head>
<title>Testing</title>
</head>
<body>
Testing error log of Apache server
</body>
</html>
And, whenever I accessed this site, I will get the error in error.log file of Apache, like this:
[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" />
Now, the code of website test.html is:
Code:
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon" />
<title>Testing</title>
</head>
<body>
Testing error log of Apache server
</body>
</html>
OK, and don't forget put a favicon.ico file in the same folder of this page.
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.

Last edited by SimonKing; 11-07-2012 at 01:46 PM.
 
Old 11-25-2012, 08:08 PM   #11
byeagley
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Rep: Reputation: Disabled
Wink

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!)
 
Old 11-25-2012, 08:10 PM   #12
byeagley
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Rep: Reputation: Disabled
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.
 
  


Reply

Tags
apache2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache2 complains 'sysconfig.d/include.conf' not found tacca Linux - Software 1 03-24-2011 09:23 AM
A CVS system that can automatically transfer updated file to htdocs Vikas Jayna Linux - Software 2 04-21-2007 11:55 PM
No htdocs for Apache animelook Linux - Software 5 08-04-2006 07:37 PM
Apache2: apachectl command not found hektor Linux - Software 3 01-14-2005 12:23 PM
LTSP server TFTP file not found error LinuxRam Linux - Networking 11 09-02-2004 12:13 AM


All times are GMT -5. The time now is 03:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration