To clarify, and kick it off, the framework stack consists of:
Since the server is already running, there should be a server section on your nginx.conf file similar to this:
In order to password protect an existing site, you need to first generate a password file. The easiest way is to achieve it is to use a web application such as the Htpasswd Generator. Then, store the generated text in a file in the server.
Next, edit the nginx.conf file again and change the server section to:
Finally, paste the location of your .htpasswd file at:
Notice the passenger_enabled entry inside the password protect section? This entry is needed to trigger Passenger after completing the password authentication process. Otherwise the server will try to list the web root directory, and probably show an unauthorized error.
And we're done. It often seems way harder than it actually is, but this is really all it takes to password protect your Rails app with Passenger and Nginx.
Found this article useful? You might like these ones too!
CEO @ Imaginary Cloud and co-author of the Product Design Process book. I enjoy food, wine, and Krav Maga (not necessarily in this order).
People who read this post, also found these interesting: