Often during development, I want to expose a web application for review to a limited set of people. The easiest way to do this is to impose a password when these users connect to the application. Most often, I configure a virtual host for the application in Apache-2.4 and set it up with basic HTTP authentication using passwords.
First, create the password file using the htpasswd.exe utility, and save it under /conf as users.pwd (or whatever you want). Then for the application’s virtual host, setup password protection:
LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule authn_file_module modules/mod_authn_file.so # Password-protected resources <VirtualHost *:81> # Secure access <Location /.*> AuthType Basic AuthName "Protected Sites" AuthBasicProvider file AuthUserFile "G:\Apache2.4\conf\users.pwd" Order Deny,Allow Satisfy All Deny from all Require valid-user </Location> # Application ProxyPass / http://localhost:8091/ ProxyPassReverse / http://localhost:8091/ </VirtualHost>
Restart Apache for changes to take effect. Access to :81 applications will pop-up a password dialog for the client.
References:
* http://httpd.apache.org/docs/2.4/programs/htpasswd.html
* http://httpd.apache.org/docs/2.4/howto/auth.html
* http://httpd.apache.org/docs/2.4/mod/mod_auth_basic.html
* http://httpd.apache.org/docs/2.4/mod/mod_authn_file.html