Notes : ce domaine hébergera l'outil Portainer permettant d'administrer les containers Docker.
vi /etc/nginx/sites-available/manager.conf
server { listen 80; listen [::]:80; server_name manager.<domaine-sinp>; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $realip_remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:9000/;# ATTENTION : bien mettre un slash final ! Sinon => erreur 404 } }
cd /etc/nginx/sites-enabled/ ; ln -s ../sites-available/manager.conf manager.conf
nginx -t && nginx -s reload
docker network create nginx-proxy
cd ~/docker/manager.<domaine-sinp>
docker-compose up
CTRL+C
docker compose up -d
docker-compose down
certbot --nginx -d manager.<domaine-sinp>
server { listen 443 ssl http2; # managed by Certbot listen [::]:443 ssl http2; # managed by Certbot server_name manager.<domaine-sinp>; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $realip_remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:9000/;# ATTENTION : bien mettre un slash final ! Sinon => erreur 404 } ssl_certificate /etc/letsencrypt/live/manager.<domaine-sinp>/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/manager.<domaine-sinp>/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { listen 80; listen [::]:80; server_name manager.<domaine-sinp>; if ($host = manager.<domaine-sinp>) { return 301 https://$host$request_uri; } # managed by Certbot return 404; # managed by Certbot }
TLS with server and client verification
ca.pem
récupéré précédemment sur votre machine locale.cert.pem
récupéré précédemment sur votre machine locale.key.pem
récupéré précédemment sur votre machine locale.