I am having some difficulty with the basic setup of apache using
O'Reilly's Apache the Definitive Guide. To my knowledge I have setup
my config to the letter and get a 404 not found error when hitting the
pages supposedly being served off of my own machine locally.
I am running Fedora 1.0 with Apache 2.0
They suggest using a script which reads as follows:
test -d logs || mkdir logs
/usr/sbin/httpd -f `pwd`/conf/httpd$1.conf -d -`pwd`
the script is called go and was chmod'ed to 777
the path in which go lives is /usr/www/chp2
(reflecting the chapter of the book I am in)
in that direcrory there are directories : conf, htdocs, logs
inside conf lives httpd.conf (of course) which reads:
Listen cassowary:80 #name of server is cassowary and is reflected in /etc/hosts
Servername cassowary
DocumentRoot /usr/www/chp2/htdocs
User webuser
Group webgroup
the index file living inside htdocs is in mode -rw-r-r and belongs to
the webuser group and user
so I am unclear as to why this server is serving up 404's after apache starts.
If more clarity is needed I apologize and would be happy to make the
situation clearer.
Thank you! |
Clarification of Question by
bluethundr-ga
on
24 Feb 2005 20:09 PST
The error that is returned when the page is hit is 404 then quickly changes to "
Not Found
The requested URL / was not found on this server.
httpd launches quietly and without a hitch, but why its serving up a
URL not found page is beyond me.
Thanks!
|
Request for Question Clarification by
leapinglizard-ga
on
24 Feb 2005 20:26 PST
This is a mysterious problem. Your Apache server seems to be running
and network-accessible because it's serving the 404 page. You say that
the DocumentRoot exists and has the right permissions. I have only
three suggestions for the time being. Try them out and let me know
what happens.
First, you should probably enclose the argument to DocumentRoot in
double quotes, so it should look like this.
DocumentRoot "/usr/www/chp2/htdocs"
After you've made the change, restart Apache using the command
apachectl restart
(you may have to be root to run this) and see if it makes a difference.
Next, you may want to try
apachectl configtest
to see if it reports any syntax errors.
Finally, you should take a look at the Apache log to see whether it
contains any clues. If you don't know where your log files are
located, find the value of ServerRoot in your httpd.conf, then look
for the file logs/access_log under that directory. Take a look at the
end of the log and see whether it makes any sense. There's also an
error log at logs/error_log under the ServerRoot directory.
Let me know how it works out!
leapinglizard
|
Clarification of Question by
bluethundr-ga
on
24 Feb 2005 20:49 PST
Hi there! And thanks for taking the time to try to answer this
conundrum. I switched paths since downloading the sample sites from
O'Reilly, but that shouldn't be here nor there.
But I tried your suggestion of changing the document root to use
double quotes as you suggest. In this case it's now :
"/usr/www/APACHE3/site.toddle/htdocs".
And as usual , apache gives the thumbs up and launches without a
hitch. But navigating to the server through lynx still yields the 404
error and hitting the site through Mozilla yields still "Not Found"
the requested URLL / was not found on this server.
Running apachectl as you suggest yields a "Syntax OK" message. And so
the mystery thickens and I still am shrugging my shoulders on this
one. Very frustrating, indeed. Especially considering that I _appear_
to be doing everything correctly.
Thanks!
bluethundr
|
Request for Question Clarification by
leapinglizard-ga
on
24 Feb 2005 21:50 PST
Have you taken a look at the access_log and error_log files? If you
post, say, the last five lines of each after an attempted web access,
I'll see what I can make of them.
Also, if your httpd.conf doesn't contain any confidential information,
it would help if you could copy it to a functioning web server and
post a link to it.
By the way, does your DocumentRoot contain a file called index.html?
If not, what happens if you add one?
leapinglizard
|
Clarification of Question by
bluethundr-ga
on
25 Feb 2005 09:54 PST
Hi, and thanks again for your help. In downloading the example site
from O'Reilly there was no "access_log" file inside the logs folder.
But there is an error_log file. The last five lines read:
------------------------------------------------------------------------------------
[Fri Feb 25 07:15:05 2005] [warn] pid file
/usr/www/APACHE3/site.toddle/logs/httpd.pid overwritten -- Unclean
shutdown of previous Apache run?
[Fri Feb 25 07:15:05 2005] [notice] Apache/2.0.47 (Fedora) configured
-- resuming normal operations
[Fri Feb 25 07:15:48 2005] [error] [client 127.0.0.1] Attempt to serve
directory: /usr/www/APACHE3/site.toddle/htdocs/
[Fri Feb 25 07:16:03 2005] [error] [client 127.0.0.1] Attempt to serve
directory: /usr/www/APACHE3/site.toddle/htdocs/
[Fri Feb 25 07:16:17 2005] [error] [client 127.0.0.1] Attempt to serve
directory: /usr/www/APACHE3/site.toddle/htdocs/
-----------------------------------------------------------------------------------
My httpd.conf file is totally unconfidential. I don't have access to a
functioning webserver at the moment, but the file is tiny. So here are
its contents:
------------------------------------------------------------------------------------
User webuser
Group webgroup
ServerName cassowary
Listen 80
DocumentRoot "/usr/www/APACHE3/site.toddle/htdocs/"
#fix 'Out of the Box' default problems - remove leading #s if necessary
ServerRoot /usr/www/APACHE3/site.toddle
#ErrorLog logs/error_log
#PIDFile logs/httpd.pid
#TypesConfig conf/mime.types
--------------------------------------------------------------------------------
The only file that came with the sample download was a file called
"1.txt". I did try copying it to a file called index.html and that
didn't change a thing. Lynx still sends the message back "Alert!
HTTP/1.1 404 not found" then quickly takes you to a page that reads:
404 Not found. The requested URL / was not found on this server.
Mozilla yields a window with a title bar that reads 404 not found and
the body of the document is the same as was found in Lynx.
This is driving me nuts!
Thanks!!
|
Clarification of Question by
bluethundr-ga
on
25 Feb 2005 09:57 PST
One more note I forgot to address was that "1.txt" was living inside
htdocs as was its copy that I named "index.html"
|