beevelop/docker-nginx-basic-auth
About
:closed_lock_with_key: Simple Docker image for basic authentication
Systems & InfrastructureMeasured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalNginx Basic Auth proxy
Protect an HTTP service behind nginx with HTTP Basic authentication. This image uses the full nginx 1.31.10 Alpine base and listens on container port 80.
Quickstart
Run the proxy and an example upstream on the same Docker network.
docker network create nginx-auth-demo
docker run -d --network nginx-auth-demo --name web nginx:alpine
docker run -d --network nginx-auth-demo --name auth \
-p 127.0.0.1:8080:80 beevelop/nginx-basic-auth
curl -u foo:bar http://127.0.0.1:8080/
The example credentials are foo and bar. Supply your own password records with HTPASSWD when deploying the proxy. The existing Compose and Swarm example can also run the demo.
Configuration
| Variable | Default | Description |
|---|---|---|
HTPASSWD |
foo / bar |
Inline htpasswd records separated by newlines. Single-quote literal records to preserve dollar signs in hashes. |
FORWARD_HOST |
web |
Upstream address reachable from the container. |
FORWARD_PORT |
80 |
Upstream HTTP port. |
For a custom login, create an htpasswd file with a tool such as htpasswd -cB users.htpasswd alice, then pass its contents as -e HTPASSWD="$(cat users.htpasswd)" when creating the container. One record per line enables multiple users. Compose YAML requires literal dollar signs in inline hashes to be escaped as $$.
The proxy forwards the client's Authorization header to the upstream after successful authentication. The launcher renders the templates from /opt into /etc/nginx on startup.
Build and test
docker build -t nginx-basic-auth:local .
bash .github/scripts/smoke.sh nginx-basic-auth:local
Pull requests exercise the existing proxy contract and build all seven supported platforms. Scheduled builds refresh latest and nightly daily at 10:00 UTC. Branch pushes, version tags, and manual runs can publish as before. Use a release tag or digest when you need to pin a deployment.
All Docker images
| Badge | Docker Hub | Build Status | Published | Release / Tag | License |
|---|---|---|---|---|---|
Use tags where possible, because

Explore related projects
Loading…