- Dockerfile multi-etapa: build con Playwright (sitio, PDF, precompresión) y nginx sin privilegios en 8080 con healthcheck - nginx: CSP sin unsafe-inline, HSTS, nosniff, Referrer-Policy, caché inmutable para assets con hash, gzip_static, página 404 y /salud - scripts: verificar-prohibidas (falla con PLD, Odoo, lavado, CHM, 115/2026 en dist/), verificar-metricas (falla con resultado sin método), comprimir - Lighthouse CI con umbral 95 en móvil y presupuesto de 1.5 MB / 50 KB de JS - GitHub Actions: check, build, verificaciones, PDF, Lighthouse e imagen Docker Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
# Sitio estático de Collina Systems. nginx sin privilegios (puerto 8080) detrás
|
|
# de Traefik (Coolify), que termina TLS. Las cabeceras de seguridad se incluyen
|
|
# en cada location porque add_header no se hereda cuando un bloque define otras.
|
|
|
|
server {
|
|
listen 8080;
|
|
listen [::]:8080;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
server_tokens off;
|
|
absolute_redirect off;
|
|
|
|
# Compresión: archivos precomprimidos en el build (.gz) y gzip al vuelo como respaldo.
|
|
gzip on;
|
|
gzip_static on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml font/woff2;
|
|
|
|
include /etc/nginx/snippets/seguridad.conf;
|
|
|
|
# Assets con hash en el nombre: caché larga e inmutable.
|
|
location /_astro/ {
|
|
include /etc/nginx/snippets/seguridad.conf;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# Fuentes: nombres estables; se renombran si cambian.
|
|
location /fonts/ {
|
|
include /etc/nginx/snippets/seguridad.conf;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location ~* \.(png|jpg|jpeg|webp|avif|svg|ico|mp4|webm|pdf)$ {
|
|
include /etc/nginx/snippets/seguridad.conf;
|
|
add_header Cache-Control "public, max-age=604800";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# HTML: siempre revalidar.
|
|
location / {
|
|
include /etc/nginx/snippets/seguridad.conf;
|
|
add_header Cache-Control "no-cache";
|
|
try_files $uri $uri/ $uri.html =404;
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
|
|
location = /salud {
|
|
access_log off;
|
|
add_header Content-Type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
}
|