PDA

View Full Version : How to set Apache2's default folder?


kenquad
August 25th, 2006, 03:02 PM
Hey all:

Simple question, I guess, just can't figure it out. Where in apache2.conf (or anywhere else, for that matter) do I go to set the default document folder? This is a LAN application, not an actual website, and what I want to do is set it up so that when somebody types in the IP address of my computer, they always see a certain document. Any help would be appreciated. Thanks.

Ken Quad

chonger
August 25th, 2006, 03:17 PM
You want to set DocumentRoot and DirectoryIndex in combination. The first sets the root directory (aka folder) of the server, the second sets the default file to display in a directory.

kenquad
August 25th, 2006, 03:22 PM
You want to set DocumentRoot and DirectoryIndex in combination. The first sets the root directory (aka folder) of the server, the second sets the default file to display in a directory.

So are these variables in apache2.conf? Because I can't find them.

harisund
August 25th, 2006, 04:05 PM
No, they are in /etc/apache2/sites-available/default

kenquad
August 25th, 2006, 04:54 PM
Question answered; thanks both!

kenquad
August 28th, 2006, 02:12 PM
OK, maybe not quite answered :-) I don't see a DirectoryIndex parameter in the config file, just some <directory> tags which seem intended to set permissions for the root directory. Am I missing something or will I have to add this parameter?

Thanks,
Kenquad

lamego
August 28th, 2006, 05:11 PM
lamego@lamego-desktop:/etc/apache2$ grep -r DirectoryIndex *
apache2.conf:DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
lamego@lamego-desktop:/etc/apache2$

lugos
August 28th, 2006, 06:48 PM
I had the same question. I found DirectoryIndex, and I'd like to keep that the same. But I couldn't find how to change the default directory. Here is what I have come across, but I don't know which needs to be changed:

In my apache2.conf file
# UserDir is now a module
#UserDir public_html
#UserDir disabled root

#<Directory /home/*/public_html>
#AllowOverride FileInfo AuthConfig Limit
#Options Indexes SymLinksIfOwnerMatch IncludesNoExec
#</Directory>

Or in my default file (/etc/apache2/sites-available)
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

Or in my 000-default file (/etc/apache2/sites-enabled)
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

Any help would greatly appreciated.

Thanks,
lugos

harisund
August 28th, 2006, 10:41 PM
First, 000-default is basically just a symbolic link back to default in the sites-available folder.

Next, wherever you see /var/www/ in the sites-available/default folder, change it to your required folder.

shanbyrt
October 8th, 2007, 03:46 PM
The following posted by lamego:

Code:

lamego@lamego-desktop:/etc/apache2$ grep -r DirectoryIndex *

Found the dir.conf file in the mods-available/ dir for my install of the out-of-the-box LAMP server. I needed to add *gulp* index.cfm to my DirectoryIndex.

Hope this helps someone.