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.

52 lines
1.2 KiB

9 years ago
9 years ago
9 years ago
  1. # nginx-envtpl
  2. Nginx image with support for environment variables using [envtpl](https://github.com/andreasjansson/envtpl)
  3. ## Usage
  4. ```sh
  5. $ docker run -d -p 80:80 -e NGINX_WORKER_RLIMIT_NOFILE=... -v ./nginx.conf.tpl:/etc/nginx/nginx.conf.tpl schickling/nginx-envtpl
  6. ```
  7. ### Example `nginx.conf.tpl`
  8. ```nginx
  9. worker_processes auto;
  10. worker_rlimit_nofile {{ NGINX_WORKER_RLIMIT_NOFILE }};
  11. error_log /dev/stdout info;
  12. events {
  13. worker_connections {{ NGINX_WORKER_CONNECTIONS }};
  14. use epoll;
  15. multi_accept on;
  16. }
  17. http {
  18. proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
  19. access_log /dev/stdout;
  20. server {
  21. listen 80 backlog={{ NGINX_BACKLOG }};
  22. root /usr/share/nginx/html/;
  23. index index.html;
  24. server_name localhost;
  25. charset utf-8;
  26. location / {
  27. proxy_pass {{ NGINX_PROXY_ADDR }};
  28. proxy_cache my_zone;
  29. proxy_cache_methods POST;
  30. proxy_cache_key "$request_uri|$request_body";
  31. proxy_cache_valid 5s;
  32. proxy_cache_use_stale error timeout updating;
  33. add_header X-Proxy-Cache $upstream_cache_status;
  34. }
  35. }
  36. }
  37. ```