worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile off; keepalive_timeout 65; gzip off; upstream php { server 127.0.0.1:9000; } {{if (getenv "DOMAINS")}} {{range $domain := split (getenv "DOMAINS") ";"}} server { listen 8080; server_name {{ $domain }}; root /var/lib/roundcube; index index.php index.html; client_max_body_size 1G; add_header X-Clacks-Overhead "GNU Terry Pratchett"; location ~ ^/(data|config|\.ht|db_structure\.xml|README|AUTHORS|COPYING-AGPL|COPYING-README) { deny all; } location / { try_files $uri $uri/ index.php; } location ~ ^(?.+?\.php)(?/.*)?$ { try_files $script_name = 404; include fastcgi_params; fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS on; fastcgi_read_timeout 300; fastcgi_pass php; } location ~* ^.+.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires 30d; access_log off; } } {{end}} {{end}} }