Apache2: Whitelist & htpasswd

Créer un fichier password:

htpasswd -c /usr/local/apache/passwd/site-passwords vincent

Modifier le fichier de config apache2

nano /etc/apache2/sites-enables/site.conf

<file apache site.conf> <IfModule mod_ssl.c> <VirtualHost *:443>

ServerName site.be

RewriteEngine on

ProxyPass / http://172.31.32.105/ nocanon
ProxyPassReverse / http://172.31.32.105/

<proxy *>
<RequireAny>
AuthType Basic
AuthName Documents
AuthBasicProvider file
AuthUserFile "/usr/local/apache/passwd/site-passwords"
Require valid-user
Require ip 1.2.3.4

</RequireAny>
</proxy>

SSLCertificateFile /etc/letsencrypt/live/site/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/site/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule></site>