Giter VIP home page Giter VIP logo

reverse-proxy-cdn's Introduction

Simple Reverse Proxy Content Delivery Network v1.0.0-alpha1

This is a very simple, but functional, Reverse Proxy with caching, that can be used as your own CDN, with good defaults that almost work out of the box. Uses docker.

Quickstart:

$ git clone [email protected]:alligo/reverse-proxy-cdn.git
$ cd reverse-proxy-cdn
$ docker build -t alligo/reverse-proxy-cdn .
$ docker run --rm -p 80:80 -p 443:443 --ulimit memlock=9223372036854775807 --name simplecdn alligo/reverse-proxy-cdn

How to customize and debug

Just to keep it simple, this solution uses just one docker container instead of make one container for NGinx, Varnish and the Crawler.

Default configurations files are on folder [configuration/_default]. Any custom change, just copy file from a path without _default, and make your changes.

Debug:

$ docker exec -it simplecdn bash
$ docker run --rm -p 80:80 -p 443:443 -p 8888:8888 -p 8080:8080 --ulimit memlock=9223372036854775807 --name simplecdn alligo/reverse-proxy-cdn

Test to proxy http://cdn.fititnt.org/img/emerson-rocha-luiz.jpg

$ # Allow example
$ curl -I http://127.0.0.1/http://cdn.fititnt.org/img/emerson-rocha-luiz.jpg
HTTP/1.1 200 OK
date: Sun, 10 Jul 2016 06:24:14 GMT
server: Apache
last-modified: Tue, 08 Mar 2016 04:44:25 GMT
etag: "1b18-52d823c58bc40"
accept-ranges: bytes
content-length: 6936
cache-control: max-age=2592000
expires: Tue, 09 Aug 2016 06:24:14 GMT
connection: close
content-type: image/jpeg


$ # Deny example
$ curl -I http://127.0.0.1/https://www.bcdonadio.com/images/me.jpg
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Date: Sun, 10 Jul 2016 06:26:32 GMT
Connection: keep-alive

@todo

  • Implement SSL
  • Implement Crawler via proxies (need more test)

Troubleshot

ulimit: max locked memory

Error:

"Running S20-varnish.sh... /etc/init.d/varnish: line 36: ulimit: max locked memory: cannot modify limit: Operation not permitted"

Solution: do on machine that runs docker

$ sudo su
$ cat >> /etc/security/limits.conf <<-EOF
docker          hard    memlock         82000
docker          soft    memlock         82000
docker          hard    nofile          131072
docker          soft    nofile          131072
EOF
$ service docker restart

reverse-proxy-cdn's People

Contributors

bcdonadio avatar fititnt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.