Class Coffee Class Coffee - 4 days ago 5
Apache Configuration Question

Loading a HTML page from webfoot folder of apache server - newbie

As the tittle says I'm new to all concepts of networkiing and web development.

Yesterday I was able to set up a Local Apache Server which I am using for development testing purposes.

I have assigned for a Server the ServerName "client1.dev" with a VirtualDocumentRoot "/www/client1/wwwroot", yet it is unclear for me how I am supposed to link my HTML page.

I am currently stuck at the point where all my files when accessing the domain appear under a plain list format from which I can select my files which will eventually load the HMTL content of choosing.

Since I'm a total beginner in this domain and I've got a hard time even googling the right questions. I'd like to know how I could instantly when accessing the server name domain to load a given HTML page.

Answer

By default, the Apache HTTP server will look for a file named index.html in the directory that is displayed. If it finds such a file, the index.html will be displayed. Otherwise it falls back to list the contents of the directory (but that could be changed to disallow directory listings).

If you do not have an index.html file in the directory, the easiest solution would be to create one.

If you want to display another file by default, then you can change that in the Apache configuration. Use the DirectoryIndex directive to do that. A basic example that changes the index files for the /foo directory looks like this:

# Example A: Set index.html as an index page,
# then add index.php to that list as well.
<Directory "/foo">
    DirectoryIndex index.html
    DirectoryIndex index.php
</Directory>

# Example B: This is identical to example A,
# except it's done with a single directive.
<Directory "/foo">
    DirectoryIndex index.html index.php
</Directory>
Comments