Apache problem - cannot get index.html file to show
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Apache problem - cannot get index.html file to show
I've got apache running on Slackware 9.1, go to localhost and I get the apache test page. I created a web folder to host webpages off of at /usr/web, and edited the httpd.conf file in these places:
...
DocumentRoot "/usr/web"
...
<Directory "/usr/web">
...
DirectoryIndex /usr/web/index.html
so what happens is if I type localhost, I get a directory listing.
if I type localhost/index.html, it'll display the page.
so I tried editing options in httpd.conf, by removing Indexes:
...
Options FollowSymLinks MultiViews
then when I try to view the page at localhost, it displays:
403 Forbidden
You don't have permission to access / on this server.
In this case, the error log has an entry:
[Sat Jan 15 21:35:07 2005] [error] [client 127.0.0.1] Directory index forbidden by rule: /usr/web/
but, again, if I type: localhost/index.html, it displays the page just fine.
So what I'm asking is, how do a simply make the F$#$ING thing display the index.html page by simply typing localhost.
I assumed that by placing index.html in /usr/web specified in DocumentRoot, Directory, and DirectoryIndex, that it would display that index page. Am I wrong? does the index.html file need to go somwhere else?
Firstly, the DirectoryIndex directive doesn't go inside a <Directory> tag.
Move it out. You should have a line like this at the same level as the "DocumentRoot" directive.
DirectoryIndex index.html index.htm index.cgi ...
Also, your Apache needs mod_dir.c compiled in. It most likely is since it is by default. You can tell by running "./httpd -l" to list the compiled in modules on your system.
Lastly, the <Directory> tag requires "Options Indexes" added. I believe you noted this already.
first, thanks for the reply, because I know there are tons of posts about apache.
I made the changes you mentined, but I still get a directory list instead of my index.html file:
Index of /
Parent directory ...
index.html...
is there something else I need to change in httpd.conf? I suppose I can leave it like that, if you click on the index.html link, THEN it will display the page, but I would like for this to work the "correct" way.
I decided to try changing DirectoryIndex from /usr/web/index.html to index.html, and it finally works...
note:
before this, I was trying to change permissions for a folder, I accidentally did chmod -755 /. Well, this trashed file permissions for a LOT of linux system files and folders, so after some time, I decided to reboot the computer, and it complained about the file permissions being too free, and linux didn't start, so I did a reinstall (it had a relatively fresh install of linux before).
Anyway, before all that, I PROMISE that with DirectoryIndex set to index.html, it was taking me to that retarded apache test page. Oh well, it works now.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.