Skip to content

About

Dockerfile for a no-configuration Nginx reverse proxy for a webapp such as a Ruby web server, with caching enabled and CORS settings

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

goodguide/nginx-application-proxy

This is a simple nginx container meant to be run alongside a webapp like Rails. It implements a simple HTTP caching layer just above the application (respectful of relevant headers in the application's response) and for any request for /assets it returns wide-open CORS headers.

With this, you can opt not to precompile assets (though it's still a good idea). You must however ensure the app serves assets even in a production setting. (The app serves them once to Nginx, then nginx serves them out of its cache subsequently.)

Example

Here's a typical use-case:

  1. Run the app container, giving it a volume for the static assets. In this example, we're also binding our app server to a unix socket which also lives in a (separate) Docker volume.

    docker run -d --name my-app-1 \
        --expose 3000
        my-app:latest \
        rails s
  2. Run this Nginx container, sharing the volumes from the app container into it and configuring the paths to them:

    docker run -d --name my-app-nginx-1 \
        --volumes-from my-app-1 \
        -e upstream_server_address='tcp://my-app-1:3000' \
        -p 3000:80
        goodguide/nginx-application-proxy

Configuration

There are just two configuration environment variables, both of which must be specified:

About

Dockerfile for a no-configuration Nginx reverse proxy for a webapp such as a Ruby web server, with caching enabled and CORS settings

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages