LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-14-2013, 11:06 PM   #1
great_wall
LQ Newbie
 
Registered: Feb 2013
Location: china
Posts: 5

Rep: Reputation: Disabled
Cool the url requested was not found 404!


Hi guys
I installed Apache2.2, and PHP5 on my debian.
When I do [url]http://localhost,I get "It works! This is the default web page for this server. but when I type http://localhost/var/www/index.html, I get an error saying "The requested URL was not found on this server".
when i change index.html to index.php,i get the same error 404.and the/var/www is the document root.
add:
I added the LoadModule and AddType myself after installing Apache,and i restart it,i also put index.html and index.php in the same directory.it's so weird.

This problem is really confusing... thanks to all helpers.

Last edited by great_wall; 02-15-2013 at 02:46 AM.
 
Old 02-15-2013, 01:45 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
Welcome to LQ great_wall!

1. If the file index.php resides in the document root of your server (probably /var/www) there should be no 404 error. Is there a file /var/www/index.php?
2. Did you install php module? The LoadModule directive can only load available modules. If you install php modules with apt-get then the appropiate changes in the apache conf are made automatically.

Last edited by j-ray; 02-15-2013 at 01:48 AM.
 
Old 02-15-2013, 02:34 AM   #3
great_wall
LQ Newbie
 
Registered: Feb 2013
Location: china
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by j-ray View Post
Welcome to LQ great_wall!

1. If the file index.php resides in the document root of your server (probably /var/www) there should be no 404 error. Is there a file /var/www/index.php?
2. Did you install php module? The LoadModule directive can only load available modules. If you install php modules with apt-get then the appropiate changes in the apache conf are made automatically.
Firstly,i'm sorry for my question,there's something wrong.I have corrected it.
yes,there is.and i have installed php modules with "make",instead of apt-get.

Last edited by great_wall; 02-15-2013 at 02:44 AM.
 
Old 02-15-2013, 08:10 AM   #4
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
http://localhost/var/www/index.html won't work because the server is configured to have a root directory, that is /var/www/ in Debian. So when you try to access that path it is actually looking for /var/www/var/www/index.html because you are adding directories to the path that are extraneous. If you want to access is via a full path try file:///var/www/index.html but if you do that you aren't accessing the file through Apache you will be accessing it directly by the file system.

If you check /var/www you should find the default index.html file that responds with "It works!" placed there by Apache.
 
Old 02-15-2013, 07:05 PM   #5
great_wall
LQ Newbie
 
Registered: Feb 2013
Location: china
Posts: 5

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by scheidel21 View Post
http://localhost/var/www/index.html won't work because the server is configured to have a root directory, that is /var/www/ in Debian. So when you try to access that path it is actually looking for /var/www/var/www/index.html because you are adding directories to the path that are extraneous. If you want to access is via a full path try file:///var/www/index.html but if you do that you aren't accessing the file through Apache you will be accessing it directly by the file system.

If you check /var/www you should find the default index.html file that responds with "It works!" placed there by Apache.
Thanks a lot.I have another question,when i type http;//localhost/test,i get the same error.And the test is a directory under the /var/www ,why is it?
 
Old 02-15-2013, 09:08 PM   #6
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
Three possibilities I can think of right away. 1)Is there an index file in the test directory? 2)What are the system file permissions on the directory, it will have to at least be read for everybody. 3)If there is no index file in the directory is Apache configured to provide a directory listing? That is often disabled for greater security.
 
1 members found this post helpful.
  


Reply



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
error 404 requested URL /statusmeldung was not found on this server lawassi Linux - Newbie 2 09-30-2012 02:30 AM
404 Not Found The requested URL '/zm' was not found on this server. mickeyboa Ubuntu 8 07-26-2012 11:02 AM
error 404 requested resource not found sawgata Linux - Newbie 6 05-29-2010 04:20 AM
The requested URL /defaultsite was not found on this server. lqforumuser Linux - Newbie 1 06-28-2009 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration