Apache2 Webmin - Autenticación básica


Para la Autenticacion basica, necesitaremos realizar lo siguiente: 

alumno111@ai1pc111:~$ apt -y install apache2-utils
alumno111@ai1pc111:~$ vi /etc/apache2/sites-available/auth-basic.conf
# create new

<Directory /var/www/html/auth-basic>
    SSLRequireSSL
    AuthType Basic
    AuthName "Basic Authentication"
    AuthUserFile /etc/apache2/.htpasswd
    require valid-user
</Directory>

# add a user : create a new file with [-c]

alumno111@ai1pc111:~$ htpasswd -c /etc/apache2/.htpasswd ubuntu

New password:     # set password

Re-type new password:
Adding password for user ubuntu
alumno111@ai1pc111:~$ mkdir /var/www/html/auth-basic

alumno111@ai1pc111:~$ a2ensite auth-basic

Enabling site auth-basic.
To activate the new configuration, you need to run:
  service apache2 reload

alumno111@ai1pc111:~$ systemctl restart apache2
# create a test page

alumno111@ai1pc111:~$ vi /var/www/html/auth-basic/index.html

<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for Basic Authentication
</div>
</body>
</html>


Y donde aparece (auth-basic) en "vi /var/www/html/auth-basic/index.html" sustituiremos por usuario1 y luego la copiaremos con cp -r como (usuario2) para crear dos usuarios


Comments

Popular posts from this blog

MySQL Workbench - Ubuntu

DNS Ubuntu Resolución Directa

VoIP