- First of all, you need to create a new user/password:
This command:
htpasswd -c /etc/apache2/.htpasswd myuser1
If you are using Bitnami Apps (Open edx, for example), you need follow this instruction:
htpasswd -c /opt/bitnami/apps/edx/conf/.htpasswd myuser1
- Then if you have defined a virtual host, you need to add the following lines to your apache config file.
This config:
<VirtualHost *:80>...<Location /> Deny from all #Allow from (Set IP to allow access without password) AuthUserFile /etc/apache2/.htpasswd AuthName "Restricted Area" AuthType Basic Satisfy Any require valid-user</Location>...</VirtualHost>
- In the case of Bitnami Apps, you need to add these configs inside ‘/opt/bitnami/apps/edx/conf/httpd-lms.conf’:
This config to protect all URLs.:
<Location /> Deny from all #Allow from (Set IP to allow access without password) AuthUserFile /opt/bitnami/apps/edx/conf/.htpasswd AuthName "Restricted Area" AuthType Basic Satisfy Any require valid-user</Location>
- Finally, you need to restart the Apache server.
In Bitnami Apps:
/opt/bitnami/ctlscript.sh restart apache