Reverse proxy using subdirectories
100K+
Dockerfile to build a nginx container image that proxies requests to subdirectories.
The easiest way to launch the container is using docker-compose:
wget https://raw.githubusercontent.com/hrektts/docker-nginx-proxy/master/docker-compose.yml
docker-compose up
Otherwise, you can launch the container using the docker command line:
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro hrektts/nginx-proxy
Then start any containers you want to be proxied with an environment variable
PROXY_SUBDIR=/subdirectory:
docker run -e PROXY_SUBDIR=/subdirecroty ...
The containers being proxied must expose the port to be proxied, either by using the EXPOSE directive in their Dockerfile or by using the --expose flag to docker run or docker create.
HTTPS support can be enabled as follows:
docker run -d -p 80:80 -p 443:443 -v /path/to/certs:/etc/nginx/certs \
-v /var/run/docker.sock:/tmp/docker.sock:ro hrektts/nginx-proxy
The default path to look for the SSL certificates is /etc/nginx/certs. To enable HTTPS support, this directory must contain a private key and a certificate named /etc/nginx/certs/default.key and /etc/nginx/certs/default.crt respectively, these can however be changed using the SSL_KEY_PATH and SSL_CERTIFICATE_PATH configuration parameters.
Below is the complete list of available options.
/etc/nginx/certs/default.crt./etc/nginx/certs/default.key./etc/nginx/certs/default.dhparam.pem.http.80.Content type
Image
Digest
sha256:cc098d8e3…
Size
56.2 MB
Last updated
almost 10 years ago
docker pull hrektts/nginx-proxy