Directorios protegidos Ubuntu/apache
Directorios protegidos Ubuntu
sudo htpasswd -c /etc/apache2/.htpasswd usuario1
"New password: clave1"
"Re-type new password: clave1"
sudo htpasswd /etc/apache2/.htpasswd usuario2
"New password: clave2"
"Re-type new password: clave2"
sudo mkdir -p /var/www/html/directorio_protegido113
sudo chown -R $USER:$USER /var/www/html/directorio_protegido113
sudo gedit /var/www/html/directorio_protegido100/index.html
"
<html>
<head>
<title>Bienvenido al directorio_protegido113!</title>
<meta charset="UTF-8">
</head>
<body>
<h1>directorio_protegido está trabajando113!</h1>
</body>
</html>
"
sudo chmod -R 755 /var/www/html/
sudo gedit/etc/apache2/apache2.conf
Cambiar el valor de la directiva AllowOverride None a All:
. . .
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
. . .
sudo gedit/var/www/html/.htaccess
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
sudo systemctl restart apache2
sudo systemctl status apache2
ls -al /etc/apache2/mods-available/auth_basic*
-rw-r--r-- 1 root root 94 mar 23 2022 /etc/apache2/mods-available/auth_basic.load
ls -al /etc/apache2/mods-enabled/auth_basic*
lrwxrwxrwx 1 root root 33 nov 15 21:12 /etc/apache2/mods-enabled/auth_basic.load -> ../mods-available/auth_basic.load


Comments
Post a Comment