Docker setup for nginx
·
Report Bug
·
Request Feature
Small docker setup for nginx. Utilizes jwilder/nginx-proxy and nginx-proxy/docker-letsencrypt-nginx-proxy-companion to reload configurations and renew certificates.
To get a local copy up and running follow these simple steps.
- Clone the repo
git clone https://github.com/Beuterei/nginx.git- Copy docker-compose example and edit it
cp docker-compose.override.example.yml docker-compose.override.yml && vim docker-compose.override.yml- Start docker-compose
docker-compose up --build- Navigate to
localtest.me
- Create a
.envfile
touch .env- Overwrite variables as you like (format:
{variable name}={variable value})
| Variable | Description | Default value | Required |
|---|---|---|---|
DEFAULT_EMAIL |
Defines your default email for Let's Encrypt | none | true |
PROXY_NETWORK_NAME |
Defines your proxy network name | nginxproxynet | false |
To get a copy up and running follow these simple steps.
- Clone the repo
git clone https://github.com/Beuterei/nginx.git --branch master- Create a
.env.productionfile
touch .env.production- Overwrite all variables marked under Customization as required
- Start docker-compose
docker-compose --env-file ./.env.production -f docker-compose.yml -f docker-compose.production.yml up -d- Create a
.env.productionfile
touch .env.production- Overwrite variables as you like (format:
{variable name}={variable value})
| Variable | Description | Default value | Required |
|---|---|---|---|
DEFAULT_EMAIL |
Defines your default email for Let's Encrypt | none | true |
PROXY_NETWORK_NAME |
Defines your proxy network name | nginxproxynet | false |
CF_Token |
Cloudflare API Token (for DNS-01 challenge) | none | false |
CF_Account_ID |
Cloudflare Account ID (for DNS-01 challenge) | none | false |
To issue wildcard certificates (e.g., *.yourdomain.com) or secure local domains behind a NAT using DNS validation, you can provide DNS provider credentials.
-
Configure API Credentials: Add the variables for your DNS provider to
.env.production.- Example for Cloudflare:
CF_Token=your_token CF_Account_ID=your_account_id
- Note: The token requires
Zone:Zone:ReadandZone:DNS:Editpermissions.
- Example for Cloudflare:
-
Request Wildcard Cert: In your service configuration, request the wildcard domain and enable the DNS challenge.
environment: - VIRTUAL_HOST=sub.yourdomain.com - LETSENCRYPT_HOST=*.yourdomain.com - ACME_CHALLENGE=DNS-01