These cookies enable us to remember you have used our Services before, preferences you may have indicated and information you have provided to us to give you a customised experience. For example, this would include ensuring the continuity of your registration process.
If like me you host several services at home or in production, you are not going to set up a certificate on each server or docker, the easiest way to manage certificates is to centralize certificate management in a single node or docker. Traefik is much favored but I prefer Nginx proxy manager because it is easy to use and light and above all to add a service by UI in a simpler way. Traefik is useful for its configuration files, the logic of its configuration and the integration of Docker / Kubernetes. But above all Traefik becomes the ideal solution when I load/unload containers, it is the only one that allows me to simply manage the ports dynamically.
Installation with Docker Compose
Here are the steps to configure Nginx Proxy Manager with Certbot and MariaDB using Docker Compose from ubuntu server :
sudo apt update sudo apt install -y docker.io sudo apt install -y docker-compose
Create a new directory for your Nginx Proxy Manager :
sudo mkdir /opt/nginx-proxy-manager cd /opt/nginx-proxy-manager
Create a docker-compose.yml file :
sudo nano docker-compose.yml
Paste the following configuration to your docker-compose file :
version: '3' services: app: image: 'jlesage/nginx-proxy-manager' container_name: nginx-proxy-manager ports: - '80:80' - '8081:81' - '443:443' volumes: - '/etc/localtime:/etc/localtime:ro' - '/opt/nginx-proxy-manager/data:/config' restart: always environment: - 'VIRTUAL_HOST=mydomain.com' - 'FORCE_SSL=true' - 'TZ=America/New_York' depends_on: - mariadb mariadb: image: mariadb container_name: mariadb volumes: - mariadb:/var/lib/mysql restart: always environments: MYSQL_ROOT_PASSWORD: my-secret-pw MYSQL_DATABASE: nginx_proxy_manager MYSQL_USER: nginxpm MYSQL_PASSWORD: nginxpm-password certbot: image: certbot/certbot container_name: certbot volumes: - '/opt/nginx-proxy-manager/letsencrypt:/etc/letsencrypt' - '/opt/nginx-proxy-manager/data:/data/letsencrypt' command: certonly --webroot --webroot-path=/data/letsencrypt --email firstname.lastname@example.org --agree-tos --no-eff-email --domain example.com depends_on: - app networks: default: external: name: nginx-proxy-manager_default volumes: mariadb:
Note: Replace "mydomain.com" with your domain name, "email@example.com" with your email address, and follow the prompts to generate the SSL certificate and edit mysql configuration and create a network and volume using the following command :
sudo docker network create nginx-proxy-manager_default sudo docker volume create mariadb
Start the Docker containers using the following command :
sudo docker-compose up -d
Access the Nginx Proxy Manager web interface by visiting http://mydomain.com:81. Login with the default credentials:
Follow the Nginx Proxy Manager documentation to configure your reverse proxy rules, set up SSL certificates, and more.
That's it! You have now configured Nginx Proxy Manager with Certbot and MariaDB using Docker Compose.