new-site/infra/ansible/roles/nginx/templates/pw-site-tls.conf.j2
justin f8cd37ac8c Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers,
document generators, FCC compliance tools, Canada CRTC formation,
Ansible infrastructure, and deployment scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 06:54:22 -05:00

87 lines
2.2 KiB
Django/Jinja

# {{ ansible_managed }}
# HTTPS config for performancewest.net
# Redirect HTTP -> HTTPS
server {
listen 80;
server_name performancewest.net www.performancewest.net;
location /.well-known/acme-challenge/ {
root {{ certbot_webroot }};
}
location / {
return 301 https://performancewest.net$request_uri;
}
}
# Redirect www -> apex
server {
listen 443 ssl;
http2 on;
server_name www.performancewest.net;
ssl_certificate /etc/letsencrypt/live/performancewest.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/performancewest.net/privkey.pem;
return 301 https://performancewest.net$request_uri;
}
# Main site
server {
listen 443 ssl;
http2 on;
server_name performancewest.net;
ssl_certificate /etc/letsencrypt/live/performancewest.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/performancewest.net/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# HSTS - 1 year, include subdomains
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
include /etc/nginx/snippets/pw-security.conf;
# Gzip compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/xml
image/svg+xml
font/woff2;
location / {
proxy_pass http://127.0.0.1:{{ site_port }};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Cache static assets
proxy_cache_valid 200 1h;
proxy_buffering on;
}
# Long cache for immutable assets
location /_astro/ {
proxy_pass http://127.0.0.1:{{ site_port }};
expires 1y;
add_header Cache-Control "public, immutable";
}
location /.well-known/acme-challenge/ {
root {{ certbot_webroot }};
}
}