LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

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


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

can I configure apache, so if I would request this URL:
www.xxxxx.com
it would open the default directory (/var/www/htdocs)
and if I would request:
www.xxxxx.com/sda2
it would open /mnt/sda2 and show it's contents, but first ask for username and password? Thank you!
 
Old 05-07-2006, 05:38 AM   #2
puntjuh
Member
 
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, 07:32 AM   #3
Shioni
Member
 
Registered: Mar 2006
Posts: 182

Original Poster
Rep: Reputation: 30
Thanks!
But I have one problem!! I don't have a domain name!! I found an example:
Code:
NameVirtualHost 192.168.10.10
<VirtualHost 192.168.10.10>
        ServerName local.smallshop.com
        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
        </Directory>
</VirtualHost>
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, 11:36 AM   #4
puntjuh
Member
 
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:

Code:
<VirtualHost localhost>
     ServerAdmin support@localhost.com
     DocumentRoot "www/localhost"
     ServerName localhost
#    ServerAlias www.example.com *.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
if you wanna use error logs and custom logs uncomment the line.

good luck

Last edited by puntjuh; 05-07-2006 at 11:39 AM.
 
  


Reply



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 05:53 PM
Apache 2.0, I want to list dir contents & password protect... Scrag Linux - Software 3 02-10-2005 11:38 AM
slimserver help - how to set music dir ilyash Linux - Software 1 10-24-2004 09:21 PM
apache 2 dir browsing Spaz17 Linux - Software 4 10-22-2003 03:00 PM
apache dir browsing k3v0 Linux - Software 1 08-29-2002 01:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:29 AM.

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