✨ Features: - Complete LEMP stack automation - WordPress with WP-CLI - Redis Object Cache (50% performance boost) - Multi-OS support - SSL/Let's Encrypt integration - Security hardening - Enterprise features - Docker testing environment - GitHub Actions CI/CD - Comprehensive documentation 🧪 Fully tested and production-ready Copyright (c) 2025 Sebastian Palencsár
41 lines
1.6 KiB
Django/Jinja
41 lines
1.6 KiB
Django/Jinja
# Security headers configuration for Nginx
|
|
# Generated by Ansible
|
|
|
|
# Security Headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
|
|
|
# Content Security Policy (CSP)
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.wordpress.org *.wp.com *.gravatar.com; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src 'self' fonts.gstatic.com; img-src 'self' data: *.wordpress.org *.wp.com *.gravatar.com; connect-src 'self'; frame-src 'self' *.youtube.com *.vimeo.com; object-src 'none';" always;
|
|
|
|
# HSTS (HTTP Strict Transport Security)
|
|
{% if enable_ssl is defined and enable_ssl %}
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
|
{% endif %}
|
|
|
|
# Hide Nginx version
|
|
server_tokens off;
|
|
|
|
# Limit request size
|
|
client_max_body_size 64M;
|
|
client_body_buffer_size 128k;
|
|
|
|
# Rate limiting zones (defined in main nginx.conf)
|
|
# limit_req_zone $binary_remote_addr zone=login:10m rate=1r/m;
|
|
# limit_req_zone $binary_remote_addr zone=admin:10m rate=5r/m;
|
|
# limit_req_zone $binary_remote_addr zone=api:10m rate=10r/m;
|
|
|
|
# Security-related timeouts
|
|
client_body_timeout 10s;
|
|
client_header_timeout 10s;
|
|
keepalive_timeout 65s;
|
|
send_timeout 10s;
|
|
|
|
# Buffer overflow protection
|
|
client_body_buffer_size 1k;
|
|
client_header_buffer_size 1k;
|
|
large_client_header_buffers 2 1k;
|