Notes on configuring Sencha Touch, Nginx, and Play on Mac OS X

These are a few notes on how I set up my Mac OS X development environment for my Radio Pi Mobile application (RPM). The app uses Sencha Touch for the front end, the Scala Play Framework for the backend server, and Nginx to glue them together.

The Play server

The server component of RPM is written using the Scala Play Framework. It runs on port 9000, and I configure it in Nginx like this:

# play server
upstream radio_server {
    server 127.0.0.1:9000;
}

server {

    # put `radio` in /etc/hosts
    server_name  radio;
    listen       9090;

    location / {
        index       index.html;
        root        /Applications/MAMP/htdocs/radio;
    }

    location /server {
        proxy_pass  http://radio_server;
    }

}

The Sencha Touch client

The Sencha Touch RPM client app is served by Nginx like this:

# RADIO - MOBILE
server {

    # put `radio` in /etc/hosts
    server_name  radiomobile;
    listen       5150;

    location / {
        index       index.html;
        root        /Applications/MAMP/htdocs/radiomobile;
    }

    location /server {
        proxy_pass  http://radio_server;
    }

}

Usage

To develop and test the application, I access the Play app at http://localhost:9090. I access the RPM client app at http://localhost:5150.

Nginx commands

On a related note, I control Nginx on my Mac OS X systems with these =nginx= commands:

#test
nginx -t

#start
nginx

# restart
nginx -s reload

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.