Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Protecting certain folder in a virtual host

Posted on 2004-04-14
3
Medium Priority
?
374 Views
Last Modified: 2013-11-18
I run an apache web server, utilizing named virtual  host.
I want to password protect a subfolder in the virtual host, for example this folder :

http://www.mydomain.com/tmp/

I know that I should use .htacess, but how to put this into httpd.conf ?

Here is part of my httpd.conf configuration:

DocumentRoot "/var/www/html"

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

<Directory "/var/www/html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny
    Allow from all

</Directory>

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /home/www/mydomain.com/html/
    ScriptAlias /cgi-bin/ /home/www/mydomain.com/cgi-bin/
    ServerName mars.mydomain.com
    ErrorLog /home/www/mydomain.com/logs/mydomain.com-error_log
    CustomLog /home/www/mydomain.com/logs/mydomain.com-access_log common
    CustomLog /home/www/mydomain.com/logs/mydomain.com-deflate_log deflate
</VirtualHost>
0
Comment
Question by:kapot
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
shaggyb earned 640 total points
ID: 10821604
first youll need this in the first part of the config

<Directory "path to the root of your web page">

    Options Indexes FollowSymLinks


    AllowOverride authConfig   <------------------ need that....this lets you override to allow access to lower directorys  or ask for passwords  what ever


    Order allow,deny
    Allow from all
</Directory>



then

AccessFileName .htaccess

then

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

to hide the .htaccess file in the given directory if you have indexing on



then


Alias /youralias in your expaple avoe this would be tmp "path to the directory you want to be tmp localy on your hdd example c:/windws"

<Directory "path to your dir same as what is in the quiote above">

    Options Indexes MultiViews FollowSymLinks  <-------------- the indexes is only if you want someone to be able to see the idiviual files
    AllowOverride AuthConfig     <----------- make apache look for the htaccess file
    Order allow,deny
    Allow from all

</Directory>

0
 
LVL 3

Expert Comment

by:shaggyb
ID: 10821608
damn...sorry for the typos     i need to goto sleep
0
 
LVL 15

Expert Comment

by:samri
ID: 10822983
hi Kapot,

Shaggyb is pretty much on the track.

For more information, you may want to jump to Apache website for some information, and HOWTO on how to get that achived.

http://httpd.apache.org/docs-2.0/howto/auth.html
http://httpd.apache.org/docs-2.0/howto/htaccess.html

Hope this would help.

cheers
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question