GithubHelp home page GithubHelp logo

nginx-auto's Introduction

Very simple automatic reverse proxy

Nginx-auto is an automatic reverse proxy for Docker and Podman, without configuration file and working with (automatic or not) SSL/TLS.

It's basically made for development usage.

And it's a good companion of mkcert.

Usage

This image is based on nginx:alpine, but the entrypoint will make a standard configuration to be a reverse proxy to whatever you need.

You don't need configuration files.

This is the environment you can use:

  • DOMAINS is a comma separated list of domain_name:container[:port] - e.g. DOMAINS=foo.localhost:website1,bar.localhost:another:1234
  • SSL if set to true (string) so nginx will listens on 443 and use (self generated or not) certificate and keys. (see the basic ssl example for a preview)
  • CERTS is a coma separated list of domain_name:certname:keyname where:
  • REDIRECT if set to true (string) will force http to https redirection

Basic example

You can see it in the provided basic example:

version: "3"

services:
  blog:
    image: ghost
    environment:
      url: http://blog.localhost

  http:
    image: metal3d/nginx-auto:1.16-alpine
    environment:
      DOMAINS: blog.localhost:blog:2368
    depends_on:
      - blog
    ports:
      - 80:80

You can add SSL: "true" to activate SSL and why not REDIRECT: "true" to force redirection to https.

If you have created your own certificates (e.g. with mkcert) in the form:

  • ./certs/foo.bar.key
  • ./certs/foo.bar.pem

So, your CERTS variable should be: blog.localhots:foo.bar.pem:foo.bar.key and you must mount ./certs to /etc/nginx/certs (please, use :z suffix to make it working even on SELinux systems)

Work with podman?

Traefik doesn't works with podman (yet) but anyway it will never work with rootless containers because Traefik (I love it) will use Docker/Podman API that can only work with a "daemon" or "socket".

And actually, I made nginx-auto to resolve this...

NGinx-auto doesn't use Docker/Podman API, everything works with Environment Variable. Yes, that needs a bit more of typing (or not), but there is no label to use, no specific configuration to activate certificates, and that will work great with docker-domains

The only thing to change for Podman is to allow "standard user" to open port < 1024:

# one shot
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=0

# it you want to make it permanent:
echo 'net.ipv4.ip_unprivileged_port_start=0' | sudo tee /etc/sysctl.d/99-unprivileged_port.conf
sudo systctl --system

Now, you can use podman-compose and say good bye to Docker :)

nginx-auto's People

Contributors

metal3d avatar

Watchers

 avatar  avatar

Forkers

amal-viswa

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.