User Tools

Site Tools


wiki:password_protect_site_htaccess

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:password_protect_site_htaccess [2021/01/18 14:28] – created antisawiki:password_protect_site_htaccess [2022/04/17 12:47] (current) – [See also] add link antisa
Line 1: Line 1:
 {{tag>webserver apache}} {{tag>webserver apache}}
  
-====== Password protect site with htaccess ======+====== Password protect site with htaccess in Apache ======
 ===== Create the Password File ===== ===== Create the Password File =====
  
  
  
-    apt-get install apache2 apache2-utils+    apt-get install apache2-utils
     htpasswd -c /etc/apache2/.htpasswd <username>     htpasswd -c /etc/apache2/.htpasswd <username>
  
Line 16: Line 16:
     Require valid-user     Require valid-user
  
-==== Example: ====+==== Example protecting the directory: ====
  
  
Line 27: Line 27:
             Require valid-user             Require valid-user
     </Directory>     </Directory>
 +    
 + ==== Example protecting the URL: ====
 +
 +    <Location /admin>
 +        AuthUserFile /var/www/htpasswd/.htpasswd
 +        AuthName "Password Protected Area"
 +        AuthType Basic
 +        Require valid-user
 +    </Location>
  
 Do it for both non-ssl and ssl vhost configuration Do it for both non-ssl and ssl vhost configuration
Line 36: Line 45:
  
  
- +====== See also ====== 
 +  * [[wiki:password_protect_nginx_site|Password protect nginx site]] 
 +  * [[wiki:download_file_apache_website_by_sending_custom_header|Download file from apache website by sending custom header]]
  
 ====== References ====== ====== References ======
-https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04+  * https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04 
 +  * https://tecadmin.net/how-to-secure-specific-url-in-apache/
  
wiki/password_protect_site_htaccess.1610976495.txt.gz · Last modified: 2021/01/18 14:28 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki