Giter VIP home page Giter VIP logo

nginx-https-reverse-proxy's Introduction

Local nginx https reverse proxy

Introduction

This repo is the config for my local nginx instance that provides https to my portainer instance and my grafana internet monitoring instance.

This nginx instance is set up for the following domains to be DNS pointed to it:

  • portainer.lan
  • speed.lan

I do this forwarding using pihole (ofc).

To facilitate the https you need certificates for the domains from a trusted CA. I run my own local CA with mkcert which works well for me.

The certificates and private key need putting in a ./certs directory. They are then mounted into the container in the /run/secrets directory using docker secrets.

The server blocks are configured to only listen on the 192.168.0.192 IP and their relevant ports. This means that nothing on the main network can talk to it. If you change the IP that it's going to live on then you need to replace this IP in the nginx.conf file.

Setup

Public IP address

I don't want this to just exist on a port on my raspberry pi's IP, so I created a macvlan network so that the container gets it's own IP address.

To do this run:

docker network create -d macvlan \
  --subnet=192.168.0.0/24 \
  --ip-range=192.168.0.192/26 \
  --gateway=192.168.0.1 \
  -o parent=eth0 pub_net

This assumes that you are using the 192.168.0.0/24 subnet, with 192.168.0.1 as the gateway, and you should set 192.168.0.191 as the upper limit of your DHCP address range to prevent conflicting IP allocations.

Internal services network

I don't want the other services to be accessible without going through this nginx instance, so I run them on a shared external docker network and don't expose any ports publicly.

I use the network name main, you can call it whatever you want.

docker network create main

This is the same network that my internet monitoring and portainer instances exist on.

Deployment

docker-compose up -d

Updating

docker-compose pull
docker-compose up -d

nginx-https-reverse-proxy's People

Contributors

tb942 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.