Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Running OpenShift on a Virtual Machine
Index

Using the .htaccess file to configure Apache


By now, you will be aware that OpenShift uses Apache with mod_wsgi to serve your web applications. In this recipe, you will learn to use the .htaccess and .htpasswd files to configure the Apache web server for the HTTP basic authentication. The GitHub repository for this recipe is https://github.com/OpenShift-Cookbook/chapter8-htaccess-recipe.

Getting ready

This recipe is based on the assumption that you have read the previous recipes in this chapter. To walk through this recipe, you will need the rhc command-line client installed on your machine. Please refer to the Installing the OpenShift rhc command-line client recipe in Chapter 1, Getting Started with OpenShift, for details.

How to do it…

Perform the following steps to enable the HTTP basic authentication:

  1. Create a new Python 2.7 application using the rhc command-line tool:

    $ rhc create-app myapp python-2.7
    
  2. Change the directory to myapp, and create two files, .htaccess and .htpasswd, in the myapp...