Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-07-2006, 06:22 AM   #1
Registered: Mar 2006
Posts: 182

Rep: Reputation: 30
set password for dir in Apache!

I have two directories, that I would like to be accessable:
/var/www/htdocs (default)

can I configure apache, so if I would request this URL:
it would open the default directory (/var/www/htdocs)
and if I would request:
it would open /mnt/sda2 and show it's contents, but first ask for username and password? Thank you!
Old 05-07-2006, 06:38 AM   #2
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 42
perhaps with virtual hosts. But you can protect the dir by placing a .htaccess file in it. it'll ask for user/pass when that dir/url is requested.
Old 05-07-2006, 08:32 AM   #3
Registered: Mar 2006
Posts: 182

Original Poster
Rep: Reputation: 30
But I have one problem!! I don't have a domain name!! I found an example:
        DocumentRoot /usr/home/www_root/showsite/public_html/
        ErrorLog /usr/home/www_root/showsite/error_log
        DirectoryIndex default.html
        ScriptAlias /cgi-bin/ /usr/home/www_root/showsite/public_html/cgi-bin/
        <Directory /usr/home/www_root/showsite/public_html/cgi-bin>
                Options +ExecCGI
                AddHandler cgi-scripts .cgi .pl
How can I make apache show /usr/home/www_root/showsite/public_html/ directory, when I request for example http://my.ip.addr.ess/some_dir??
Thank you!
Old 05-07-2006, 12:36 PM   #4
Registered: Apr 2006
Location: holland
Distribution: Gentoo / debian / suse / mint
Posts: 558

Rep: Reputation: 42
Then just set the http://blablablabla etc. address as the servername.

btw.. the whole virtualhost part doesn't have to be as "complicated" as the example you found. just this will do:

<VirtualHost localhost>
     DocumentRoot "www/localhost"
     ServerName localhost
#    ServerAlias *
#    ErrorLog logs/
#    CustomLog logs/ common
if you wanna use error logs and custom logs uncomment the line.

good luck

Last edited by puntjuh; 05-07-2006 at 12:39 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftp - set default dir h3xis Linux - Networking 2 04-10-2006 06:53 PM
Apache 2.0, I want to list dir contents & password protect... Scrag Linux - Software 3 02-10-2005 12:38 PM
slimserver help - how to set music dir ilyash Linux - Software 1 10-24-2004 10:21 PM
apache 2 dir browsing Spaz17 Linux - Software 4 10-22-2003 04:00 PM
apache dir browsing k3v0 Linux - Software 1 08-29-2002 02:29 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration