Nginx Reverse Proxy Docker
4.9K
Docker image for a reverse proxy, powered by nginx.
This git / docker image is desinged to demo with examples for reverse proxy together with two other Docker containers so that people can easily learn how to create reverse proxy using this Docker container:
By showing the actual working examples as the part of the demo, template, and actual configuratons, you can easily adapt or modify to become your own.
All you need to do is to provide ./etc/nginx configuration folder and launch this Docker container, then you have your customized Nginx Server. Here is the ./etc/nginx folder which will be used to map into the Nginx Container when using "./run.sh" or "docker-compose up -d":
./etc
└── nginx
├── certificates
├── conf.d
│ ├── jetty.conf
│ ├── noVNC.conf
│ └── proxy.conf
├── mime.types
├── nginx.conf
├── sites-enabled
└── ssl
├── nginx.crt (auto generated)
└── nginx.key (auto generated)
docker-compose up
The Proxied Ports by Reverse Proxy Server are
- rest-dev-vnc-docker:
- 8443:8443 # Proxy access 8443/26901 -> 6901
- 25901:25901 # Proxy access 25901 -> 5901
- 26901:26901 # Proxy access 8443/26901 -> 6901
- 28080:28080 # Proxy access 28080 -> 18080 -> 8080
Use the following URLs to test:
Note you need to replace the above "0.0.0.0" with the actual IP address when accessing from remote machines.
The Nginx container is set up by default to look for an index page at /usr/share/nginx/html, so in our new Docker container, we need to give it access to our files at that location. Let’s use the -v flag to map a folder from your local machine ~/docker-nginx/html to a relative path in the container that is /usr/share/nginx/html
This can be accomplished by using the following command in your ssh terminal.
sudo docker run --name docker-nginx -p 18880:80 -d -v ~/docker-nginx/html:/usr/share/nginx/html nginx
nginx -c /etc/nginx/nginx.conf -t
In Docker run:
docker run --rm -t -a stdout --name my-nginx -v $PWD/config/:/etc/nginx/:ro nginx:latest nginx -c /etc/nginx/nginx.conf -t
Content type
Image
Digest
Size
92.2 MB
Last updated
about 6 years ago
docker pull openkbs/nginx-reverse-proxy-docker