Git Product home page Git Product logo

docker-nginx-openvpnclient's Introduction

Docker-Nginx-OpenVPNClient

Docker powered container for using Nginx in combination with an OpenVPN Client.

Ideal for a local reverse-proxy with incoming requests coming through an OpenVPN connection.

Docker Image

Docker Pulls Docker Stars

Example scenario:

You have a docker host with containers on your local network, which you would like to be accessible to the outside world, but you can't open firewall ports. Or you simple prefer having the external ip for the services originate somewhere else. Get a VPS and set it up with an OpenVPN Host and Nginx to reverse-proxy traffic from it. Then setup this container with a custom nginx config, and an OpenVPN client connecting config that can connect to the OpenVPN Host.

This way, you can set it up so when someone visits your vps on the given port that you forward traffic from to the vpn client, the request will be proxied through the vpn connection to the container. And from there the installed Nginx instance will proxy that request to some other container(s) or service(s) you have defined.

Web Browser -> VPS --VPN-Tunnel--> This Container -> Service

It's a bit complex, but absolutely amazing when you have it running. You can also proxy in the opposite direction, if you configure the Nginx config that way.

Note

The container comes with sample configs, that'll be added to the mapped /config volume if they don't already exist. Just overwrite those with your changes.

Usage

docker create \
  --name=nginxopenvpn \
  -v <path to data>:/config \
  -e PGID=<gid> -e PUID=<uid>  \
  -p 8282:80 \
  --cap-add=NET_ADMIN \
  --device=/dev/net/tun \
  jacobpeddk/nginx-openvpnclient

Port mapping

Port mapping is optional and only needed for testing the nginx reverse proxy config locally.
To test it locally, visit: <host ip>:8282

PGID and PUID

Will define the user and group ids that the container will handle the files and processes as.

PGID can be found by executing: id -g
PUID can be found by executing: id -u

Build & Run

Download repository,and run the following command on you host to build the image.

docker build -t nginx-openvpnclient .

To test it:

docker run -it --rm --name nginxopenvpn -e PGID=<gid> -e PUID=<uid> -p 8282:80 --cap-add=NET_ADMIN --device=/dev/net/tun -v <localConfigPath>:/config nginx-openvpnclient

And if everything is set up correctly, it should now connect and proxy traffix comming from the vpn connection.

Usefull websites resources

Changelog

Important changes will be listed here.
Pattern is: year-month-date

2018-08-19

Major changes to image. Made it far more robust and smaller in size.

  • Removed dos2unix - It will no longer fix files created with wrong line ending on windows.
  • Changes image base to the alpine image with s6 support from linuxserver.io
  • Changed everything to use the s6 service handler.
  • log dir is now part of config dir.
  • Total image size decreased from 70MB to 9MB.

docker-nginx-openvpnclient's People

Contributors

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