Skip to content

Beuterei/nginx

Repository files navigation

Contributors Forks Stargazers Issues


Logo

nginx

Docker setup for nginx

· Report Bug · Request Feature

About The Project

Small docker setup for nginx. Utilizes jwilder/nginx-proxy and nginx-proxy/docker-letsencrypt-nginx-proxy-companion to reload configurations and renew certificates.

Getting Started Develop

To get a local copy up and running follow these simple steps.

Prerequisites

Installation

  1. Clone the repo
git clone https://github.com/Beuterei/nginx.git
  1. Copy docker-compose example and edit it
cp docker-compose.override.example.yml docker-compose.override.yml && vim docker-compose.override.yml
  1. Start docker-compose
docker-compose up --build
  1. Navigate to localtest.me

Customization

  1. Create a .env file
touch .env
  1. 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

Getting Started Production

To get a copy up and running follow these simple steps.

Prerequisites

Installation

  1. Clone the repo
git clone https://github.com/Beuterei/nginx.git --branch master
  1. Create a .env.production file
touch .env.production
  1. Overwrite all variables marked under Customization as required
  2. Start docker-compose
docker-compose --env-file ./.env.production -f docker-compose.yml -f docker-compose.production.yml up -d

Customization

  1. Create a .env.production file
touch .env.production
  1. 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

Wildcard Certificates & DNS Validation

To issue wildcard certificates (e.g., *.yourdomain.com) or secure local domains behind a NAT using DNS validation, you can provide DNS provider credentials.

  1. 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:Read and Zone:DNS:Edit permissions.
  2. 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