PDA

Bekijk Volledige Versie : .htaccess aanmaken in apache.



Dekker Webdesign
15/01/05, 12:05
Hallo,

Ik heb in middels een webservertje draaien met apache.
(http://dekker-fileserver.dnsalias.com) Ik heb deze draaien op apache win32.
Nu heb ik gehoord dat het met apache mogelijk is om een .htaccess file aan
te maken en deze plaatsen in een bepaalde map waarna bezoekers een
wachtwoord moeten gebruiken om de bestanden en pagina's binnen in deze map
en de onderliggende mappen van de map. Ik heb gebruik gemaakt van
http://www.html-site.nl/wachtwoord3.htm om de .htaccess file aan te maken en
daarna .htpasswd. Ik heb daar de volgende site al mee beveiligt:
http://members.lycos.nl/familievangurp/prive/. Daar werkt het perfect maar
hoe moet ik het instellen op de apache server?

Groeten,

Roy Dekker

Johan Schoone
15/01/05, 15:25
Dekker Webdesign wrote:

> Hallo,
>
> Ik heb in middels een webservertje draaien met apache.
> (http://dekker-fileserver.dnsalias.com) Ik heb deze draaien op apache
> win32. Nu heb ik gehoord dat het met apache mogelijk is om een .htaccess
> file aan te maken en deze plaatsen in een bepaalde map waarna bezoekers
> een wachtwoord moeten gebruiken om de bestanden en pagina's binnen in deze
> map en de onderliggende mappen van de map. Ik heb gebruik gemaakt van
> http://www.html-site.nl/wachtwoord3.htm om de .htaccess file aan te maken
> en daarna .htpasswd. Ik heb daar de volgende site al mee beveiligt:
> http://members.lycos.nl/familievangurp/prive/. Daar werkt het perfect maar
> hoe moet ik het instellen op de apache server?

Geldt dit voor versie 1.3 of 2.0? Er zit in elk geval een manual bij. Deze
is ook op http://httpd.apache.org te vinden.
--
Assume nothing, expect anything.

Roy Dekker
15/01/05, 19:35
Ik gebruik versie: Apache 2.0.52

"Johan Schoone" <j.schoone@chello.nl> schreef in bericht
news:CC9Gd.1394$VR2.1369@amstwist00...
> Dekker Webdesign wrote:
>
>> Hallo,
>>
>> Ik heb in middels een webservertje draaien met apache.
>> (http://dekker-fileserver.dnsalias.com) Ik heb deze draaien op apache
>> win32. Nu heb ik gehoord dat het met apache mogelijk is om een .htaccess
>> file aan te maken en deze plaatsen in een bepaalde map waarna bezoekers
>> een wachtwoord moeten gebruiken om de bestanden en pagina's binnen in
>> deze
>> map en de onderliggende mappen van de map. Ik heb gebruik gemaakt van
>> http://www.html-site.nl/wachtwoord3.htm om de .htaccess file aan te maken
>> en daarna .htpasswd. Ik heb daar de volgende site al mee beveiligt:
>> http://members.lycos.nl/familievangurp/prive/. Daar werkt het perfect
>> maar
>> hoe moet ik het instellen op de apache server?
>
> Geldt dit voor versie 1.3 of 2.0? Er zit in elk geval een manual bij. Deze
> is ook op http://httpd.apache.org te vinden.
> --
> Assume nothing, expect anything.

Wimjan
15/01/05, 21:55
Roy Dekker schreef:
> "Johan Schoone" schreef
> > Dekker Webdesign wrote:
> >
> >> [Apache-vraag]
> >> maar hoe moet ik het instellen op de apache server?
> >
> > Geldt dit voor versie 1.3 of 2.0?
>
> Ik gebruik versie: Apache 2.0.52
>
> > Er zit in elk geval een manual bij. Deze is ook op
> > http://httpd.apache.org te vinden.
>
Welk deel van de laatste opmerking snapte je niet?


Groet,

Wimjan

--
Sleet is van vroeger, tegenwoordig gaat alles kapot.

Roy Dekker
16/01/05, 14:45
Hallo,

Ik heb inmiddels de goede handleiding gevonden alleen snap er nog niet erg
veel van:

Handleiding:

================================================== =====================
Here's the basics of password protecting a directory on your server.

You'll need to create a password file. This file should be placed somewhere
not accessible from the web. This is so that folks cannot download the
password file. For example, if your documents are served out of
/usr/local/apache/htdocs you might want to put the password file(s) in
/usr/local/apache/passwd.

To create the file, use the htpasswd utility that came with Apache. This
will be located in the bin directory of wherever you installed Apache. To
create the file, type:

htpasswd -c /usr/local/apache/passwd/passwords rbowen

htpasswd will ask you for the password, and then ask you to type it again to
confirm it:

# htpasswd -c /usr/local/apache/passwd/passwords rbowen
New password: mypassword
Re-type new password: mypassword
Adding password for user rbowen

If htpasswd is not in your path, of course you'll have to type the full path
to the file to get it to run. On my server, it's located at
/usr/local/apache/bin/htpasswd

Next, you'll need to configure the server to request a password and tell the
server which users are allowed access. You can do this either by editing the
httpd.conf file or using an .htaccess file. For example, if you wish to
protect the directory /usr/local/apache/htdocs/secret, you can use the
following directives, either placed in the file
/usr/local/apache/htdocs/secret/.htaccess, or placed in httpd.conf inside a
<Directory /usr/local/apache/apache/htdocs/secret> section.

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen

Let's examine each of those directives individually. The AuthType directive
selects that method that is used to authenticate the user. The most common
method is Basic, and this is the method implemented by mod_auth. It is
important to be aware, however, that Basic authentication sends the password
from the client to the browser unencrypted. This method should therefore not
be used for highly sensitive data. Apache supports one other authentication
method: AuthType Digest. This method is implemented by mod_auth_digest and
is much more secure. Only the most recent versions of clients are known to
support Digest authentication.

The AuthName directive sets the Realm to be used in the authentication. The
realm serves two major functions. First, the client often presents this
information to the user as part of the password dialog box. Second, it is
used by the client to determine what password to send for a given
authenticated area.

So, for example, once a client has authenticated in the "Restricted Files"
area, it will automatically retry the same password for any area on the same
server that is marked with the "Restricted Files" Realm. Therefore, you can
prevent a user from being prompted more than once for a password by letting
multiple restricted areas share the same realm. Of course, for security
reasons, the client will always need to ask again for the password whenever
the hostname of the server changes.

The AuthUserFile directive sets the path to the password file that we just
created with htpasswd. If you have a large number of users, it can be quite
slow to search through a plain text file to authenticate the user on each
request. Apache also has the ability to store user information in fast
database files. The mod_auth_dbm module provides the AuthDBMUserFile
directive. These files can be created and manipulated with the dbmmanage
program. Many other types of authentication options are available from third
party modules in the Apache Modules Database.

Finally, the Require directive provides the authorization part of the
process by setting the user that is allowed to access this region of the
server. In the next section, we discuss various ways to use the Require
directive.

================================================== =====================

Nu heb ik hier over een aantal vragen:

Vraag 1: Waar moet ik het .htpasswd bestand plaatsen. Want G:\apache is de
webmap hierin staan de bestanden die te zien zijn op het web. Ik weet dus
niet waar ik de PAD van het bestand moet opgeven: /usr/local/apache/htdocs
is namelijk op de C: maar het gene wat gedeelt staat op G: waar moet ik de
stations letter aangeven??

Verdere vragen volgen hierna wel.

Alvast bedankt

Groeten,

Roy Dekker

"Wimjan" <news@inventio.nl> schreef in bericht
news:MPG.1c53a10a2ae3e88998a8cd@news.individual.ne t...
> Roy Dekker schreef:
>> "Johan Schoone" schreef
>> > Dekker Webdesign wrote:
>> >
>> >> [Apache-vraag]
>> >> maar hoe moet ik het instellen op de apache server?
>> >
>> > Geldt dit voor versie 1.3 of 2.0?
>>
>> Ik gebruik versie: Apache 2.0.52
>>
>> > Er zit in elk geval een manual bij. Deze is ook op
>> > http://httpd.apache.org te vinden.
>>
> Welk deel van de laatste opmerking snapte je niet?
>
>
> Groet,
>
> Wimjan
>
> --
> Sleet is van vroeger, tegenwoordig gaat alles kapot.

Reinoud Horstink
16/01/05, 16:45
Roy Dekker wrote:

> Hallo,
>
> Ik heb inmiddels de goede handleiding gevonden alleen snap er nog niet erg
> veel van:
>
> Handleiding:

[knip]

> Nu heb ik hier over een aantal vragen:
>
> Vraag 1: Waar moet ik het .htpasswd bestand plaatsen. Want G:\apache is de
> webmap hierin staan de bestanden die te zien zijn op het web. Ik weet dus
> niet waar ik de PAD van het bestand moet opgeven: /usr/local/apache/htdocs
> is namelijk op de C: maar het gene wat gedeelt staat op G: waar moet ik de
> stations letter aangeven??

Het .htpasswd bestand mag je neerzetten waar je maar wilt. Aangeraden
wordt echter om hem niet in de openbare htdocs-directory te plaatsen (in
jouw geval g:\apache).
Vanuit het .htaccess bestand verwijs je vervolgens naar de plek waar je
zojuist je .htpasswd hebt neergezet.

Reinoud.