{% for subdomain in ('blog', 'docs') %} server { listen 443 ssl http2; listen [::]:443 ssl http2; add_header Strict-Transport-Security "max-age={{ hsts_max_age }}; includeSubDomains; preload" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Xss-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; server_name {{ subdomain }}.tildes.net; keepalive_timeout 5; gzip_static on; {% if subdomain == "docs" %} # redirects for old docs urls, 302s in case we ever want to re-use these slugs location /code-of-conduct { return 302 https://docs.tildes.net/policies/code-of-conduct; } location /mechanics { return 302 https://docs.tildes.net/instructions; } location /overall-goals { return 302 https://docs.tildes.net/philosophy; } location /privacy-policy { return 302 https://docs.tildes.net/policies/privacy-policy; } location /technical-goals { return 302 https://docs.tildes.net/philosophy/site-implementation; } location /terms-of-use { return 302 https://docs.tildes.net/policies/terms-of-use; } location /text-formatting { return 302 https://docs.tildes.net/instructions/text-formatting; } location /topic-tagging { return 302 https://docs.tildes.net/instructions/posting-on-tildes#tagging-topics; } {% endif %} location /favicon.ico { root /opt/tildes-static-sites/theme/images; try_files $uri =404; } location /theme { root {{ static_sites_dir }}; try_files $uri =404; } location / { root {{ static_sites_dir }}/{{ subdomain }}; try_files $uri $uri.html $uri/index.html =404; } } {% endfor %}