• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

nginx compiled with aws-auth support, suitable for S3 reverse proxy usage

Motivation

This image was created for use with dogestry. We wanted a caching HTTP proxy between our servers and S3 so that images were only downloaded once from S3.

Usage

The image assumes a config file in the container at: /nginx.conf so use the -v option to mount one from your host.

docker run -p 8000:8000 -v /path/to/nginx.conf:/nginx.conf coopernurse/nginx-s3-proxy 

If you want to store the cache on the host, bind a path to /data/cache:

docker run -p 8000:8000 -v /path/to/nginx.conf:/nginx.conf -v /my/path:/data/cache coopernurse/nginx-s3-proxy 

Feel free to alter the -p param if you wish to bind the port differently onto the host.

Example nginx.conf file:

worker_processes 2;
pid /run/nginx.pid;
daemon off;

events {
	worker_connections 768;
}

http {
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	server_names_hash_bucket_size 64;

	include /usr/local/nginx/conf/mime.types;
	default_type application/octet-stream;

	access_log /usr/local/nginx/logs/access.log;
	error_log  /usr/local/nginx/logs/error.log;

	gzip on;
	gzip_disable "msie6";
	gzip_http_version 1.1;
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    proxy_cache_lock on;
    proxy_cache_lock_timeout 60s;
    proxy_cache_path /data/cache levels=1:2 keys_zone=s3cache:10m max_size=30g;

    server {
        listen     8000;

        location / {
            proxy_pass https://your-bucket.s3.amazonaws.com;

            aws_access_key your-access-key;
            aws_secret_key your-secret-key;
            s3_bucket your-bucket;

            proxy_set_header Authorization $s3_auth_token;
            proxy_set_header x-amz-date $aws_date;

            proxy_cache        s3cache;
            proxy_cache_valid  200 302  24h;
        }
    }
}

Things you want to tweak include:

  • proxy_cache_path
    • alter max_size as desired
    • if you want the cache stored external to the container, alter the path
  • proxy_pass
  • aws_access_key
  • aws_secret_key
  • s3_bucket
  • proxy_cache_valid - change 24h to your cache duration as desired.

More Repositories

1

node-pool

Generic resource pooling for node.js
JavaScript
2,369
star
2

caddy-awslambda

Caddy plugin that gateways requests to AWS Lambda
Go
45
star
3

barrister

clean contracts
Python
39
star
4

barrister-ruby

Ruby bindings for Barrister RPC
Ruby
23
star
5

radiator

STOMP broker in python/gevent
Python
14
star
6

cis194

Homework assignments for UPenn cis 194 - Haskell
Haskell
13
star
7

maelstrom

Container orchestration for non-PhD candidates
Go
11
star
8

barrister-js

node.js and browser Javascript bindings for Barrister RPC
JavaScript
11
star
9

votenoir

Demo voting system using clojure and noir on app engine
JavaScript
10
star
10

barrister-go

Barrister RPC bindings for the Go language
Go
8
star
11

barrister-java

Java runtime for Barrister RPC
Java
6
star
12

bookfriend

bookfriend.me in Clojure / App Engine / Noir
Clojure
5
star
13

iris-bench

Go
4
star
14

backbone-poc

Backbone + Barrister proof of concept app
JavaScript
3
star
15

clj-appengine-oauth

OAuth library for Clojure and Google App Engine
Clojure
3
star
16

ansible-demo

Python
3
star
17

barrister-php

PHP bindings for Barrister RPC
PHP
2
star
18

aspen-demo

Demo web site for the Aspen web server
Python
2
star
19

docker-nim

Docker image for Nim compiler and nimble package manager
Nim
2
star
20

polygen

JSON-RPC stub compiler
Go
2
star
21

barrister-demo-contact

Barrister RPC Demo - Contact Service
Python
2
star
22

doctorj

Turns your JSON API spec into HTML and JSON schema files
Python
2
star
23

GoMySQLDriver

MySQL driver for Go exp/sql package
Go
1
star
24

vote

Clojure library to tabulate polls or election results
Clojure
1
star
25

haste-todomvc

TodoMVC example in Haste
CSS
1
star
26

aws-java-backup

Java tools to copy Amazon S3 and SimpleDB data
Java
1
star
27

pjdev

Paul/James development repo
HCL
1
star
28

actionstrumpwords

actionstrumpwords.com data and site
1
star
29

disbandspd.org

Disband the Seattle Police Department
CSS
1
star
30

barrister-site

Barrister web site contents (Jekyll)
JavaScript
1
star
31

barrister-clj

Clojure bindings for Barrister RPC
Clojure
1
star
32

talk-docker-swarm

Docker Swarm Talk
CSS
1
star
33

vote-web

Kotlin voting app
Kotlin
1
star
34

statespec

stateful generative testing for Go
Go
1
star
35

vpc-nat-cfn

CloudFormation template that creates a VPC with bastion/nat host
1
star
36

regressr-runner-client

Client bindings for regressr runner. Use in your test classes.
1
star
37

jocko

Domain neutral services for Java - including NoSQL persistence
Java
1
star
38

retina

HTTP to Iris gateway
Go
1
star
39

apex-chicken

Deploy Chicken Scheme programs to AWS Lambda using Apex
Scheme
1
star
40

maelstrom-dashboard

JavaScript
1
star