Tuesday, May 19, 2015

Proteja Diretoriu Web Ho .htaccess


.htaccess nudar file konfigurasaun ne'ebe fornesidu husi servidor web Apache, utilizadu para modifika fungsaun default Apache. Ida husi fungsaun .htaccess mak hanesan proteja diretoriu web, hodi nune'e wainhira asesu ba diretoriu web refere liu aplikasaun browser, tenki hatama lai username no password.

Notas:
Pratika ne'e Autores teste iha Apache versaun 2.4.7 ho sistema operasaun Linux Mint 17.1 "Rebecca".

Tuir mai lalaok oinsa proteja diretoriu web ho .htaccess:
  • Loke aplikasaun Terminal liu husi menu: System Tools → Terminal

  • Kria file .htpasswd para rai username no password ho maneira:
    sudo htpasswd -c /etc/apache2/.htpasswd admin
    Notas:
    Bele troka "admin" ho naran saida deit.

  • Kontinua kria file .htaccess iha diretoriu web ne'ebe hakarak ita proteja.
    sudo nano /var/www/html/.htaccess
    Notas:
    Iha ezemplu ne'e Autores aplika ba diretoriu default servidor web Apache (/var/www/html).

    No hatama parametru tuir mai ne'e:
  • AuthType Basic
    AuthName "Restricted Files"
    AuthBasicProvider file
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user
  • Loke file apache2.conf
    sudo nano /etc/apache2/apache2.conf
    Buka parametru iha kraik ne'e:
    <Directory /var/www/>
            Options FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    
    Modifika parametru refere hanesan tuir mai:
    <Directory /var/www/>
            Options FollowSymLinks
            AllowOverride Authconfig
            Require all granted
    </Directory>
    
  • Restart fali Apache ho maneira:
    sudo service apache2 restart
    ou
    sudo /etc/init.d/apache2 restart
  • Loke aplikasaun browser hanesan Mozilla Firefox, no digitandu enderesu http://127.0.0.1

    Janela Autentikasaun Iha Browser Mozilla Firefox
    Karik mosu janela autentikasaun hanesan ilustrasaun iha leten, hatama deit username no password ne'ebe kria ona.
Boa sorte!

Referensia:
Oinsa Utiliza Editor Testu Nano?
Maneira Fasil Instala LAMP iha Linux Mint 17
Fahe artiklu ne'e
  • Fahe ba Facebook
  • Fahe ba Twitter
  • Fahe ba Google+
  • Fahe ba Stumble Upon
  • Fahe ba Evernote
  • Fahe ba Blogger
  • Fahe ba Email
  • Fahe ba Yahoo Messenger
  • Seluktan...

Iha komentariu 4

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© Mata Dalan Linux & Software Livre
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Posts RSSComments RSS
Back to top