# apache 2,2 displays It Works not auto displaying index.htm



## ripv (Aug 31, 2011)

Hi,

I've installed Apache 2.2 on a new install of FreeBSD 8. I've edited the httpd.conf and set my server name, directory and directory index. This is all local at the moment so http://192.168.75.5 displays "It Works" even though my Directory Index lists index.htm and I have an index.htm in the correct place - if I type http://192.168.7.5.5/index.htm in to the browser I get the correct page displayed.

I'd really appreciate any help.


----------



## wblock@ (Sep 1, 2011)

.htm is an artifact of operating systems that could only handle three-character extensions.  .html is the correct extension.


----------



## ripv (Sep 1, 2011)

I've also created an index.html and tried adding it to the DirectoryIndex but the behaviour is still the same.

If I type http://192.168.75.5 into my browser, I get the / added, so the page displayed is http://192.168.75.5/ I get a page that just says "It Works!". I tried adding the DirectoryIndex to the <Direcory /> section in the httpd.conf. I tried creating a .htaccess in the default folder where the index.htm and index.html are located: /usr/local/etc/apache22/data and putting a DirectoryIndex in the .htaccess file   .... all to no avail  

However,
if I type http://192.168.75.5/index.htm I get the correct page displayed;
if I type http://192.168.75.5/index.html I get the correct page displayed.

Relevant sections from httpd.conf

```
ServerRoot "/usr/local"

Listen 192.168.75.5:80

ServerName 192.168.75.5:80

DucumentRoot "/usr/local/www/apache22/data"

DirectoryIndex index.htm index.html
```


----------



## DutchDaemon (Sep 1, 2011)

Is it actually in the container?


```
<IfModule dir_module>
        DirectoryIndex index.html index.html.var index.php
</IfModule>
```

And is the module actually loaded?


```
# httpd -M | grep dir_module
 dir_module (shared)
 userdir_module (shared)
Syntax OK
```


----------



## wblock@ (Sep 1, 2011)

ripv said:
			
		

> Relevant sections from httpd.conf
> 
> ```
> [color="Red"]DucumentRoot[/color] "/usr/local/www/apache22/data"
> ```



Typo in the file or in the paste?


----------



## ripv (Sep 1, 2011)

Thanks to wblock and DutchDaemon for your time and help..
It actually turned out I had a typo in the httpd.conf, not for DocumentRoot but in the DirectoryIndex, which was in the correct container.
I had

```
DirectoryIndex index.htm index.[B]hmtl[/B]
```
once I changed it to 

```
DirectoryIndex index.htm index.[B]html[/B]
```
and restarted Apache it started working


----------



## wmoreno3 (Oct 17, 2011)

I have similar problem, when I enter in my case displays http://mydomain.com.co/index.html "It works!" To http://ipaddress/index.html displays the correct page.


----------



## ripv (Oct 20, 2011)

As posted above my problem was a simple typing error in the httpd.conf configuration file in Apache.

http://forums.freebsd.org/showpost.php?p=145797&postcount=6

I don't think you have the same problem to be honest, yours looks like it is DNS related as the direct IP works.


----------



## wmoreno3 (Oct 20, 2011)

*"It works!"*

Thank you for the reply, I already identified the problem, but not to be due, in my case, is caused by domain forwarding, when I try to "mydomin.com.co ipaddress" in the DNS A Record, index.html, it displays the correct page.
I have: FreeBSD 8.2 P4, apache-2.2.21, php5-5.3.8, no index.html with "It works!" into it.


----------

