Sunday, January 01, 2017

Apache basic-auth setup



sudo htpasswd -c /etc/apache2/.htpasswd <username>

sudo vi /etc/apache2/conf/subdomain.conf
<VirtualHost 1.2.3.4:443>
       ServerName subdomain.domain.net
       ServerAdmin webmaster@domain.net
     
       CustomLog /var/logs/subdomain_access_log combined
       ErrorLog /var/logs/subdomain_error_log
DocumentRoot /home/subdomain
LogLevel warn
<Directory "/home/chapters/subdomain">
    Options Includes ExecCGI FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
SSLEngine on
SSLCertificateFile /tmp/fullchain.pem
SSLCertificateKeyFile /tmp/privkey.pem
SSLCertificateChainFile  /tmp/chain.pem
SSLCACertificateFile  /tmp/cert.pem 
</VirtualHost>

sudo service apache2 restart

No comments:

Post a Comment

Thank you for your feedback