# worker_processes 1; daemon off; worker_rlimit_nofile 1024; events { worker_connections 800; } http { error_log /var/log/{{ service.id | replace("/", "_") }}_error.log warn; access_log /var/log/{{ service.id | replace("/", "_") }}_access.log; include /etc/nginx/mime.types; default_type application/octet-stream; index index.html index.htm index.xhtml; fastcgi_param HTTP_PROXY ""; keepalive_timeout 65; server_tokens off; {% for user in consumers["www"] %} server { listen {{ port(service.id) }} ; listen [::]:{{ port(service.id) }} ; server_name {{ user.domain }} ; location / { root {{ user.root }} ; } } {% endfor %} {% for user in consumers["http"] %} server { listen {{ port(service.id) }}; listen [::]:{{ port(service.id) }}; server_name {{ user.domain }} *.{{ user.domain }}; location / { proxy_set_header Host $host; proxy_next_upstream_timeout 2s; proxy_pass http://127.0.0.1:{{ port(user.id) }}/; } } {% endfor %} }