Coder Social home page Coder Social logo

Comments (1)

theit8514 avatar theit8514 commented on September 26, 2024

TBH, I don't really use this all that much anymore. I previously had a single IP + single host SSL certificate and wanted to secure multiple docker containers behind it. The setup I use now no longer requires this project.

I found my old init files for the docker containers I used then. Here is the setup process for the nginx container:
docker run -d --name nginx-proxy-subdirectory --restart=always -p 19080:80 -p 19443:443 -e EXTERNAL_HTTPS_PORT=19443 -v /var/run/docker.sock:/tmp/docker.sock:ro -v /volume1/docker/nginx-proxy-subdirectory/certs:/etc/nginx/certs -v /volume1/docker/nginx-proxy-subdirectory/vhost.d:/etc/nginx/vhost.d theit8514/nginx-proxy-subdirectory

This container runs both a HTTP and HTTPS port, and the HTTP port redirects to 443 by default. The EXTERNAL_HTTPS_PORT setting changes the port that is used for the redirect (if you use NAT and don't use external port 443, then this should be whichever port you have your NAT set to).

Then for each of the containers hosting services, I would add environment variables to which subdirectory that container should be hosted at:
-e VIRTUAL_PORT=8081 -e NGINX_PROXY_SUBDIRECTORY=my_directory -e NGINX_PROXY_SUBDIRECTORY_MAP_TO_ROOT=0

If I accessed the host via https://localhost:19443/my_directory/, nginx would proxy the request to the docker container that has NGINX_PROXY_SUBDIRECTORY=my_directory. The VIRTUAL_PORT setting determines which port to use on the container, and NGINX_PROXY_SUBDIRECTORY_MAP_TO_ROOT setting determines if the subdirectory is appended to the internal request. In this case, the request would be proxied to http://<docker container ip>:8081/my_directory/

from nginx-proxy-subdirectory.

Related Issues (1)

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.