DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.