password protect directory in ubuntu plesk .htaccess .htpasswd

Firefox.jpg

 

so you want to password protect your apache directory so people can’t sneak a peek.

you’ll need two files in your directory:

.htaccess and .htpasswd

.htaccess source

AuthType Basic

AuthName “restricted area”

AuthUserFile /var/www/vhosts/YourDomain.com/httpdocs/.htpasswd

require valid-user

 

AuthUserFile is the file path on your server to the .htpasswd file. on ubuntu + plesk 9 the path is:

/var/www/vhosts/YourDomain.com/httpdocs/.htpasswd

.htpasswd source

user-name:csmBH39TKAkle

 

the user name is first separated by a colon and then a MD5 coded text is needed for the password… use this fancy tool to make key value pairs with MD5 password

Web Development Tools | David Walsh - MooTools, jQuery Consultant-2.jpg

 

 

make sure you edit your site config file

/etc/apache2/sites-available

nano "yoursitename"

change the AllowOverride none to AllowOverride all
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

Leave a Reply

Your email address will not be published. Required fields are marked *