選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Launching new servers with SSL certificates
  2. ## Short description
  3. docker compose certbot configurations with Backward compatibility (without certbot container).
  4. Use `docker compose --profile certbot up` to use this features.
  5. ## The simplest way for launching new servers with SSL certificates
  6. 1. Get letsencrypt certs
  7. set `.env` values
  8. ```properties
  9. NGINX_SSL_CERT_FILENAME=fullchain.pem
  10. NGINX_SSL_CERT_KEY_FILENAME=privkey.pem
  11. NGINX_ENABLE_CERTBOT_CHALLENGE=true
  12. CERTBOT_DOMAIN=your_domain.com
  13. CERTBOT_EMAIL=example@your_domain.com
  14. ```
  15. execute command:
  16. ```shell
  17. docker network prune
  18. docker compose --profile certbot up --force-recreate -d
  19. ```
  20. then after the containers launched:
  21. ```shell
  22. docker compose exec -it certbot /bin/sh /update-cert.sh
  23. ```
  24. 2. Edit `.env` file and `docker compose --profile certbot up` again.
  25. set `.env` value additionally
  26. ```properties
  27. NGINX_HTTPS_ENABLED=true
  28. ```
  29. execute command:
  30. ```shell
  31. docker compose --profile certbot up -d --no-deps --force-recreate nginx
  32. ```
  33. Then you can access your serve with HTTPS.
  34. [https://your_domain.com](https://your_domain.com)
  35. ## SSL certificates renewal
  36. For SSL certificates renewal, execute commands below:
  37. ```shell
  38. docker compose exec -it certbot /bin/sh /update-cert.sh
  39. docker compose exec nginx nginx -s reload
  40. ```
  41. ## Options for certbot
  42. `CERTBOT_OPTIONS` key might be helpful for testing. i.e.,
  43. ```properties
  44. CERTBOT_OPTIONS=--dry-run
  45. ```
  46. To apply changes to `CERTBOT_OPTIONS`, regenerate the certbot container before updating the certificates.
  47. ```shell
  48. docker compose --profile certbot up -d --no-deps --force-recreate certbot
  49. docker compose exec -it certbot /bin/sh /update-cert.sh
  50. ```
  51. Then, reload the nginx container if necessary.
  52. ```shell
  53. docker compose exec nginx nginx -s reload
  54. ```
  55. ## For legacy servers
  56. To use cert files dir `nginx/ssl` as before, simply launch containers WITHOUT `--profile certbot` option.
  57. ```shell
  58. docker compose up -d
  59. ```