/var/www/private.yourdomain.com/htdocs
2. Buat file .htaccess :
[root@prayogi ~]# cd /var/www/private.yourdomain.com/htdocs [root@prayogi htdocs]# vi .htaccess isikan baris berikut :AuthType Basic AuthUserFile /var/www/private.yourdomain.com/htdocs/.htpasswd AuthName private require valid-user satisfy any[root@prayogi htdocs]# chown wwwrun .htaccess (wwwrun adlh user yg menjalankan apache) [root@prayogi htdocs]# chmod 644 .htaccess
3. Buat htpasswd (pastikan apache sudah berjalan, bisa cek di sini untuk instalasi apache)
[root@prayogi htdocs]# /usr/local/apache2/bin/htpasswd -bc .htpasswd admin adminpassword[root@prayogi htdocs]# chown wwwrun .htpasswd (wwwrun adlh user yg menjalankan apache)[root@prayogi htdocs]# chmod 644 .htpasswd
4. Tambahkan konfigurasi berikut pada vhost di httpd.conf anda :
<Directory "/var/www/private.yourdomain.com/htdocs"> deny from all Options ExecCGI AllowOverride AuthConfig Order deny,allow </Directory>
5. Restart service apache dan tes dari browser dengan mengakses domain anda. Jika waktu membuka halaman anda diminta untuk memasukkan user password, masukkan user password seperti yang anda buat saat membuat .htpasswd.
0 comments:
Post a Comment