infra/roles/nitter/templates/01-nitter.conf.j2

32 lines
1.3 KiB
Django/Jinja

server {
listen 443 ssl http2;
{% if inventory_hostname in wg_clients -%}
listen {{ wg_clients[inventory_hostname].ip }}:443 ssl http2;
{% endif -%}
include listen-proxy-protocol.conf;
server_name {{ nitter_url }};
access_log /var/log/nginx/access_{{ nitter_url }}.log main;
error_log /var/log/nginx/error_{{ nitter_url }}.log warn;
ssl_certificate /usr/local/etc/certs/{{ nitter_url }}/fullchain.pem;
ssl_certificate_key /usr/local/etc/certs/{{ nitter_url }}/privkey.pem;
# Security Headers
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header Content-Security-Policy "default-src 'none'; script-src 'self' 'unsafe-inline'; img-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; object-src 'none'; media-src 'self' blob:; worker-src 'self' blob:; base-uri 'self'; form-action 'self'; frame-ancestors 'self'; connect-src 'self' https://*.twimg.com; manifest-src 'self'";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
location / {
proxy_pass http://{{ bridgewithdns.nitter }}:{{ nitter_port }};
}
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nDisallow: /\n";
}
}