Apache Global Config & Virtual Servers

Hey guys. On my Global Apache Config, I have this:

[code:1]<Directory />
Options -Indexes
AllowOverride None
</Directory>/code]

But when I go to joinpgn.com/downloads, you can still index the files.

I was just wondering how do I change it for my virtual servers plus the addition of making it default on all additional virtual servers I will be making in the future. Thanks! [/code:1]

Oh and how come your Fireboard CODE TAG is different than the normal Fireboard CODE Tag, did you guys change it? If it’s publicly available, may I know where to download it? Thanks!<br><br>Post edited by: P4rD0nM3, at: 2008/06/25 09:24

I’ll answer part of your question –

If you log into Virtualmin, choose "System Settings", then "Server Templates", click "Default Settings", and then choose "Apache Website" from the dropdown list – you can then setup the template you wish to use for Virtual Hosts. In that, you can include any Apache options you wish in "Directives and settings for new websites", such as -Indexes.

As for how to do that for all your Virtual Hosts? That’s an excellent question :slight_smile: I’m not sure of a way to do that through Virtualmin (which is entirely different than there being no way to do it).

There’s always the option of firing up Vim and using a regex to add that in, but perhaps someone else has an idea of how you might do that through Virtualmin.
-Eric

when adding it to the template then it will be used for all future created domains. for existing domains I suspect one could use Apache’s global config or if needed add it to the <virtualhosts> parts at the bottom of that config file for all hosts at once.

or use a commandline to add it to all hosts but then you’ll need to cook a line up.

through virtualmin I guess go to webmin-servers-apache server-and do each server manually through their respective config.

my 2 cents

I’m surprised VM doesn’t hide directory contents by default. Isn’t that almost always desirable?

I too am now looking for a global way to add "Options -Indexes" for all exiting virtual hosts.

Ok this thread seemed to have died… but I’ll see if I can fan it back to life.

Did we come up with global way to re-set all existing virtual servers to options -indexes i.e. to not show indexes?

will

<Directory />
Options -Indexes
AllowOverride None
</Directory>/code]

in the global httpd.conf

do it?

and, since we want to be able to allow indices in some directories. if we have the

AllowOverride None

in the global config, will this mean that if I put a .htacess file in a particular directory that it will not work? Of course "just try it, dude" is one answer, but I just wanted to check in first for advice or any "gotchas"…

I agree with webwzrd, the default should be options -indexes; (why would you want to let people see all the files by default?) in fact we imported Plesk sites with the migration tool and those sites did not allow showing indexes by default. I had to put a .htaccess in any directory where we wanted to show indexes of all files therein. But the imported virtual servers running under virtualMin all do show indexes.

No, unfortunately, the settings in the individual VirtualHosts would be overriding anything in the parent config.

I’m not aware of a way to do what you’re after, without making a change to each VirtualHost.

If anyone else has any thoughts on that though, feel free to speak up! :slight_smile:
-Eric

I ended up doing as Eric just suggested and handled it through the virtualhost. I edited the existing ones and changed the template for all new ones.

fine, no big deal… I only have 8 virtual servers, so it’s not a huge burden to change them all. "go with the flow…’ and all that… :slight_smile:

thanks

well that’s strange, because for me on Debian, /etc/apache2.conf has no reference to Options, only a default set IndexOptions, and all folders are not indexable by default (if i navigate to a vhost’s main domain); i get a ‘Forbidden’ error, which is ok, because there is no index file under the domain so it auto-prevents indexing the domain folder, or any folders under it if they exists in similar fashion.

I’ll assume you actually restarted apache after you edited the main config file? Also, make sure there aren’t any other files being included that might override the directory settings.

Well hmmm…yes, strange indeed… I had restarted httpd, for sure.

I’m pretty sure somewhere on your web server you must have “Option -Indexes” must be there in some manner, if you are getting forbidden on attempts to access directories without index files. “IndexOptions”, doesn’t govern if they are shown or not shown. Apache docs:

"The IndexOptions directive specifies the behavior of the directory indexing."

e.g. a useful outcome of this R & D was that I discovered…

NameWidth=[n |
] (Apache 1.3.2 and later)
The NameWidth keyword allows you to specify the width of the filename column in bytes. If the keyword value is '
’, then the column is automatically sized to the length of the longest filename in the display.

so that long file names are never truncated…Yahoo! (I’ve been looking for that one for a long time…)

How to access website on my Apache Web server from any computer? Want to have my website viewable to anybody in the world! Got Apache installed. Putted a website consisting of combination of html/php files… What’s next?

My websites are hosted on an Apache server through GoDaddy. I’m using the options +index command on a .htaccess page to display directories. I’d like the first column to be as long as it needs to be to show long file names. Also I’d like to know how to put info in the file name (?) so that it shows up in the description. I tried putting NameWidth=[n | ] in the .htaccess page, but that does work. Any help for someone who doesn’t usually do these kinds of commands.

Thanks!