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-multiple-networks.yml 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. networks:
  19. - default
  20. - outside
  21. logging:
  22. driver: ${NGINX_WEB_LOG_DRIVER:-json-file}
  23. options:
  24. max-size: ${NGINX_WEB_LOG_MAX_SIZE:-4m}
  25. max-file: ${NGINX_WEB_LOG_MAX_FILE:-10}
  26. nginx-gen:
  27. image: jwilder/docker-gen
  28. command: -notify-sighup ${NGINX_WEB:-nginx-web} -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
  29. container_name: ${DOCKER_GEN:-nginx-gen}
  30. restart: always
  31. volumes:
  32. - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
  33. - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
  34. - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
  35. - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:ro
  36. - ${NGINX_FILES_PATH:-./data}/htpasswd:/etc/nginx/htpasswd:ro
  37. - /var/run/docker.sock:/tmp/docker.sock:ro
  38. - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
  39. networks:
  40. - default
  41. - outside
  42. logging:
  43. driver: ${NGINX_GEN_LOG_DRIVER:-json-file}
  44. options:
  45. max-size: ${NGINX_GEN_LOG_MAX_SIZE:-2m}
  46. max-file: ${NGINX_GEN_LOG_MAX_FILE:-10}
  47. nginx-letsencrypt:
  48. image: jrcs/letsencrypt-nginx-proxy-companion
  49. container_name: ${LETS_ENCRYPT:-nginx-letsencrypt}
  50. restart: always
  51. volumes:
  52. - ${NGINX_FILES_PATH:-./data}/conf.d:/etc/nginx/conf.d
  53. - ${NGINX_FILES_PATH:-./data}/vhost.d:/etc/nginx/vhost.d
  54. - ${NGINX_FILES_PATH:-./data}/html:/usr/share/nginx/html
  55. - ${NGINX_FILES_PATH:-./data}/certs:/etc/nginx/certs:rw
  56. - /var/run/docker.sock:/var/run/docker.sock:ro
  57. environment:
  58. NGINX_DOCKER_GEN_CONTAINER: ${DOCKER_GEN:-nginx-gen}
  59. NGINX_PROXY_CONTAINER: ${NGINX_WEB:-nginx-web}
  60. networks:
  61. - default
  62. - outside
  63. logging:
  64. driver: ${NGINX_LETSENCRYPT_LOG_DRIVER:-json-file}
  65. options:
  66. max-size: ${NGINX_LETSENCRYPT_LOG_MAX_SIZE:-2m}
  67. max-file: ${NGINX_LETSENCRYPT_LOG_MAX_FILE:-10}
  68. networks:
  69. default:
  70. external:
  71. name: ${NETWORK:-webproxy}
  72. outside:
  73. external:
  74. name: ${SERVICE_NETWORK:-webservices}