Forum Moderators: phranque

Message Too Old, No Replies

Want to prevent users seeing directory listing in virtual hosts

Want to prevent users seeing directory listing in virtual hosts

         

and1c

10:24 pm on Jan 11, 2006 (gmt 0)

10+ Year Member



Hi
I have apache 2x running on RHEL4 server with virtual hosts I have just got set up.
I could access all domains that I have set up as virtual hosts if I type say www.example.co.uk I got a directory listing of the BASE MAIN html directory that this Virtual host resides in!

So I can see the virtual hosts folder along with all the other virtual hosts folders and any other files I may have in my Root web directory!

If I then go into the correct folder I get the correct index.html main page of the site (the only page at the minute!) eg/ the site appears to be working once I actually reach it!

Now...I have created a .htaccess in the root html directory to see if that worked (with Index Ignore*) I just get an internal 500 server error for all domains now :(

PLEASE...ANY HELP GRATEFULL RECEIVED! Also, I have tried options ALL (this is how all Options are currently) ... ..indexes on, follow symlinks etc
//////////////////

and the Virtual Host bit of my httpd.conf (for one virtual host with IP changed to dummy and domain name adjusted for safety)

#
# Use name-based virtual hosting.
#
NameVirtualHost 82.***.31.11:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

<VirtualHost 82.***.31.11:80>

ServerAdmin webmaster@example.co.uk
DocumentRoot /var/www/html/example.co.uk
ServerName example.co.uk
ErrorLog /var/log/httpd/example.co.uk/mydomain2-errorlog
CustomLog /var/log/httpd/example.co.uk/mydomain2-accesslog combined
Options ALL

</VirtualHost>

[edited by: jdMorgan at 11:52 pm (utc) on Jan. 11, 2006]
[edit reason] example.com and obscured IP address. [/edit]

jdMorgan

1:49 am on Jan 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should have a separate VirtualHost section for each virtual host, each with its own DocumentRoot directive pointing to a unique directory for that host.

Using Options -Indexes will disallow directory listings, but that is not how you should control the situation at hand.

[added] See [httpd.apache.org...] [/added]

Jim