cajyl.com
  • Software
  • Hardware
  • Operating System
  • Security
  • Docker
  • Lifestyle
  • Uncategorized
  • Français

Categories

  • Backup
  • Books
  • Data
  • Docker
  • Docker Compose
  • Docker Container
  • Firefox
  • Google Chrome
  • Hardware
  • Homelab
  • iOS
  • Linux
  • MacOS
  • Office & Productivity
  • Open Source
  • Ordering
  • Plugins
  • Synology
  • Tutos
  • Uncategorized
  • Windows
  • WordPress
Choose a job you love
  • Software
  • Hardware
  • Operating System
  • Security
  • Docker
  • Lifestyle
  • Uncategorized
  • Français
  • Uncategorized

Nginx-Proxy and Nginx-Proxy-Acme: Simplify Reverse Proxy and SSL Certificate Management

  • Augustin
Total
0
Shares
0
0
0

nginx-proxy and nginx-proxy-acme are two powerful tools that simplify the management of reverse proxies and SSL certificates for your Docker applications. These tools are particularly useful for those who host several applications on the same server and want to manage traffic routing and SSL certificates automatically. This article explores the main benefits of these tools and provides a detailed guide to installing and configuring them using Docker Compose.

Why choose Nginx-Proxy and Nginx-Proxy-Acme?

1. Simplified management of Reverse Proxies

nginx-proxy makes it easy to manage multiple Docker applications using an Nginx reverse proxy. It automatically detects Docker containers and configures Nginx to redirect them according to domain headers.

2. Automatic SSL Certificates with LetsEncrypt

nginx-proxy-acme is an add-on to nginx-proxy that automates SSL certificate management with Let’s Encrypt. It automatically generates and renews SSL certificates, guaranteeing greater security without manual intervention.

3. Dynamic Configuration

Both tools use dynamic configuration to simplify the management of virtual hosts and SSL certificates. You don’t need to modify the Nginx configuration files manually every time you add or remove a container.

4. Open Source and Free

Both tools are open source and free, allowing you to use them, modify them and adapt them to your needs at no cost.

Installing Nginx-Proxy and Nginx-Proxy-Acme with Docker Compose

Installing nginx-proxy and nginx-proxy-acme via Docker Compose is simple. Here’s a step-by-step guide to configuring these tools on your server.

Prerequisites

Before you start, make sure that Docker and Docker Compose are installed on your server. You can install them using the following commands:

sudo apt update
sudo apt install docker.io docker-compose -y

Creating the Docker Compose file

Create a docker-compose.yml file in a directory of your choice. This file will contain the configuration required to deploy nginx-proxy and nginx-proxy-acme. Use the following code to configure the services:

version: '3'

services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx-proxy_conf:/etc/nginx/conf.d
      - ./nginx-proxy_vhosts:/etc/nginx/vhost.d
      - ./nginx-proxy_certs:/etc/nginx/certs
      - /var/run/docker.sock:/tmp/docker.sock
    restart: always

  nginx-proxy-acme:
    image: nginxproxy/acme-companion
    container_name: nginx-proxy-acme
    volumes:
      - ./nginx-proxy_certs:/etc/nginx/certs
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - [email protected]
    depends_on:
      - nginx-proxy
    restart: always

Explanations

  • nginx-proxy:
  • image: Indicates the official Docker image for nginx-proxy.
  • container_name: Name of the container for easy identification.
  • ports: Maps container ports 80 and 443 to host ports 80 and 443 to manage HTTP and HTTPS traffic.
  • volumes: Mounts the directories needed to store the Nginx configuration, certificate files and communication with the Docker socket.
  • restart: Ensures that the container restarts automatically in the event of failure.
  • nginx-proxy-acme:
  • image: Indicates the official Docker image for nginx-proxy-acme.
  • container_name: Name of the container for easy identification.
  • volumes: Mounts the directories needed to store SSL certificates and communication with the Docker socket.
  • environment: Defines the email address for certificate renewal notifications.
  • depends_on: Ensures that nginx-proxy-acme starts after nginx-proxy.

Launch Services

Once you have created the docker-compose.yml file, start the services with the following command:

sudo docker-compose up -d

This command downloads the Docker images, creates the containers, and starts nginx-proxy and nginx-proxy-acme in the background. The services will be automatically configured to handle HTTP and HTTPS requests for your Docker applications.

Configuring Docker Containers

For nginx-proxy to manage Docker containers, you need to set the VIRTUAL_HOST and LETSENCRYPT_HOST environment variables in your other Docker services. Here is an example configuration for a Docker container:

version: '3'

services:
  web:
    image: your-web-app
    environment:
      - VIRTUAL_HOST=yourdomain.com
      - LETSENCRYPT_HOST=yourdomain.com
      - [email protected]

Conclusion

nginx-proxy and nginx-proxy-acme are powerful tools for managing reverse proxies and SSL certificates for your Docker applications. Thanks to their simple installation via Docker Compose and their ability to automate the management of SSL certificates, these tools make it much easier to administer your web services while ensuring greater security.

Useful links

  • Official Nginx-Proxy website
  • Nginx-Proxy GitHub repository
  • Official website of Nginx-Proxy-Acme
  • Nginx-Proxy-Acme GitHub repository

Share your experiences with nginx-proxy and nginx-proxy-acme and ask your questions in the comments section!

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Augustin
Augustin

Previous Article
blank
  • Docker
  • Docker Compose
  • Docker Container

PeerTube: Decentralised Video Sharing Platform

  • Augustin
View Post
Next Article
blank
  • Uncategorized

Tailscale: Simplify Network Management with a Zero-Trust VPN

  • Augustin
View Post
You May Also Like
blank
View Post
  • Uncategorized

UniFi Express: Optimising Your Home Network with a Reliable Solution

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

Cloudflare: Maximising the Features of the Free Version

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

HAProxy with pfSense: Optimising Load Balancing and High Availability

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

WireGuard: The Modern VPN for Optimal Security and Performance

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

pfSense: The Essential Open Source Firewall and Router Solution

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

Tailscale: Simplify Network Management with a Zero-Trust VPN

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

WordPress: The Essential Content Management Solution

  • Augustin
  • July 19, 2024
blank
View Post
  • Uncategorized

Librespeed: Open Source Solution for Testing Connection Speed

  • Augustin
  • July 19, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


Recent Posts

  • Guide – Obsidian with free, self-hosted, instant sync
  • Complete Guide to Vim Commands
  • Bitwarden: The Ultimate Password Management Solution
  • UniFi Express: Optimising Your Home Network with a Reliable Solution
  • Cloudflare: Maximising the Features of the Free Version
Choose a job you love
and you will never work a day

Input your search keywords and press Enter.