Automated docker nginx proxy integrated with letsencrypt. Based on https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

docker-compose.yml 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. version: '3'
  2. services:
  3. nginx-web:
  4. image: nginx
  5. labels:
  6. com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
  7. container_name: ${NGINX_WEB:-nginx-web}
  8. restart: always
  9. ports:
  10. - "${IP:-0.0.0.0}:${DOCKER_HTTP:-80}:80"
  11. - "${IP:-0.0.0.0}:${DOCKER_HTTPS:-443}:443"
  12. volumes:
  13. - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
  14. - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
  15. - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
  16. - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro
  17. - ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro
  18. logging:
  19. driver: ${NGINX_WEB_LOG_DRIVER:-json-file}
  20. options:
  21. max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m}
  22. max-file: ${NGINX_WEB_LOG_MAX_FILE:-10}
  23. nginx-gen:
  24. image: jwilder/docker-gen
  25. command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
  26. container_name: ${DOCKER_GEN:-nginx-gen}
  27. restart: always
  28. volumes:
  29. - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
  30. - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
  31. - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
  32. - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro
  33. - ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro
  34. - /var/run/docker.sock:/tmp/docker.sock:ro
  35. - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
  36. logging:
  37. driver: ${NGINX_GEN_LOG_DRIVER:-json-file}
  38. options:
  39. max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m}
  40. max-file: ${NGINX_GEN_LOG_MAX_FILE:-10}
  41. nginx-letsencrypt:
  42. image: jrcs/letsencrypt-nginx-proxy-companion
  43. container_name: ${LETS_ENCRYPT:-nginx-letsencrypt}
  44. restart: always
  45. volumes:
  46. - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
  47. - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
  48. - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
  49. - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:rw
  50. - /var/run/docker.sock:/var/run/docker.sock:ro
  51. environment:
  52. NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-gen}
  53. NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-web}
  54. logging:
  55. driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file}
  56. options:
  57. max-size: ${NGINX_LETSENCRYPT_LOG_MAX_SIZE:-2m}
  58. max-file: ${NGINX_LETSENCRYPT_LOG_MAX_FILE:-10}
  59. networks:
  60. default:
  61. external:
  62. name: ${NETWORK:-webproxy}