Giter Club home page Giter Club logo

nginx-certbot-route53's Introduction

Simple nginx reverse proxy with auto ssl generation

A simple nginx reverse proxy configuration to secure app on a different destination port. This docker also include an auto ssl certificate generation process and auto renewal, using letsencrypt certificates with the certbot client and certbot-dns-route53 plugin.

Certificate will be generated on initial start and a cronjob will be configured to attempt certificate renewal once a week. If the certificates are not yet within 30 days of expiry, the renewal process will not be completed.

This version will be using the certbot dns-route53 plugin, so an AWS access key and secret key with sufficient rights will be required to update route53 dns records. Please see https://certbot-dns-route53.readthedocs.io/en/stable/ for IAM permissions and a sample IAM policy.

NB Ensure your DNS has been configured correctly. Create an A record for SERVERNAME to point to the public IP address of your host, or else the certificate authorization will fail.

Run with:

docker run -d --name='nginx' --net='bridge' \
      -e 'SERVERNAME'='fqdn' \
      -e 'SRVPORT'='port' \
      -e 'HOSTIP'='host_ip' \
      -e 'DESTPORT'='dest_port' \
      -e 'EMAIL'='your_email' \
      -e 'ACCESS_KEY'='your_aws_access_key' \
      -e 'ACCESS_KEY'='your_aws_secret_key' \
      -p '443:443/tcp' \
      -v '/tmp/nginx/config':'/etc/nginx/conf.d/' \
      -v '/tmp/nginx/sslcerts':'/etc/letsencrypt/' \
      jakezp/nginx

Change:
SERVERNAME - FQDN of host / instance / site
SRVPORT - Port nginx will listen on
HOSTIP - Host IP address
DESTPORT - Port of the destination application / service
EMAIL - Email address (required for letsencrypt certificates)
ACCESS_KEY - AWS Access key
SECRET_KEY - AWS Secret key
/tmp/nginx/config - preferred nginx config location on the host
/tmp/nginx/sslcerts - letsencrypt config and cert location

NB: Ensure you expose the correct port (same port as specified in SRVPORT)

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.