PDA

View Full Version : [ubuntu] Apache2 and Index.html and Index.php



ericinwisconsin
December 15th, 2008, 04:42 PM
I'm running Ubuntu 8.04. Here's my odd little issue...

I'm running Apache2 on my home computer for my intranet. The server displays index.php just fine, but any directory with index.html gives me a 403 error.

My /etc/apache2/mods-enabled/dir.conf looks like this:



<IfModule mod_dir.c>

DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

</IfModule>

A search with



find . -exec grep "index.php" '{}' \; -print

verifies that the only places "index.php" appears in my /etc/apache2 directory and subdirectories is in mods-available/dir.conf and mods-enabled/dir.conf.

I have verified, with a phpinfo.php file, that mod_dir is running. I haven't tested index.cgi or index.pl, as cgi scripts are not enabled for my main web directory (/var/www).

Any idea why the server likes index.php but not index.html?

MJN
December 15th, 2008, 05:00 PM
Are the permissions okay on the index.html file(s)?

Mathew

wizard10000
December 15th, 2008, 05:00 PM
The 403 error hints at a permissions issue. Are you sure there isn't a conflicting instruction in httpd.conf?

ericinwisconsin
December 15th, 2008, 10:02 PM
Yep, the permissions are 644, which is the same for both index.html and index.php files.

My httpd.conf file is there, but it's blank.

Coreigh
December 15th, 2008, 10:29 PM
Do you have index.html defined as a usable index file in httpd.conf?

If you type the full URL with the index.html does it display then?

i.e. - "http://servername/directory/index.html"

In my /etc/apache2/httpd.conf there is a line like this:

DirectoryIndex index.html index.htm index.php

It defines what default pages are available and in what order to show them if two or more exist in a directory.

ericinwisconsin
December 15th, 2008, 11:20 PM
Yep, the permissions are 644, which is the same for both index.html and index.php files.

My httpd.conf file is there, but it's blank.

MJN
December 15th, 2008, 11:24 PM
Ownerships too?

As Coreigh said, can it be reached directly?

Does the error log say anything?

We could also do with seeing your config (site specific, and apache2.conf if changed)

Mathew

Coreigh
December 15th, 2008, 11:34 PM
I always forget about my log files.

located in /var/log/apache2 there is a a series of files for each access and error logs. They can tell you what is being denied.

ericinwisconsin
December 15th, 2008, 11:43 PM
Here's the only real error from my error.log file:



apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


Not related, I'm sure.

Wow, my config files? All of them? Rather than do that, let me say that it's a standard Kubuntu 8.04 installation and the only change I've made to Apache so far is to add a virtual host in the site-enabled/000-default file, so that I can access the server across the Internet (without having to worry about my ISP changing the IP address). Here are the lines I added:



<VirtualHost *>
DocumentRoot /var/www/websites/mydomain.xxx.org
ServerName mydomain.xxx.org
</VirtualHost>

ericinwisconsin
December 15th, 2008, 11:48 PM
Do you have index.html defined as a usable index file in httpd.conf?

If you type the full URL with the index.html does it display then?

i.e. - "http://servername/directory/index.html"

In my /etc/apache2/httpd.conf there is a line like this:


It defines what default pages are available and in what order to show them if two or more exist in a directory.

Nope, it still doesn't process the html file properly.

MJN
December 15th, 2008, 11:49 PM
So nothing appears in the error log when the user receives a 403 error? What about the access log?

Post the ls -l output of an affected directory.

Come on Eric, your laziness is really not helping solve your problem.

Mathew

MJN
December 16th, 2008, 12:00 AM
Just a thought, make sure your error log really is active by requesting a URL you know not to exist. Does it get logged?

Mathew

Coreigh
December 16th, 2008, 12:01 AM
Also what is the exact error message? You said it was a 403 but which one, can you post the exact message?