El navegador (HSTS/HTTPS-First de Chrome) forzaba https:// y recibía el certificado de localesp.es (default_server 443): de ahí el "me redirige a https". El DNS sí permite ACME, así que se emite certificado real. - deploy/nginx.conf: un único server block con listen 80 y 443; así las reglas anti-indexación (X-Robots-Tag, 403 a rastreadores, robots.txt inline y fallback SPA) no se duplican. El puerto 80 sigue sirviendo la app sin redirección. - location ^~ /.well-known/acme-challenge/ con root /var/www/letsencrypt: el webroot ACME queda fuera del árbol desplegado para que el 'rsync --delete' no borre el challenge durante una renovación. - scripts/deploy.sh: exige el certificado antes de tocar nada, crea el webroot, y verifica 200 en HTTP y HTTPS validando la cadena y el nombre del certificado (curl --resolve, sin -k) además de X-Robots-Tag. - README: TLS, rutas del certificado y del webroot; ya no hay aviso de "sin TLS a propósito".
66 lines
2.8 KiB
Nginx Configuration File
66 lines
2.8 KiB
Nginx Configuration File
# remigracion.jumpingcrab.com — entorno privado de previsualización.
|
|
#
|
|
# Sirve el build estático de Vite desde /opt/remigracion/dist por HTTP y HTTPS
|
|
# en el mismo server block. El certificado lo emite certbot con webroot en
|
|
# /var/www/letsencrypt y se renueva con el timer del sistema (el deploy-hook
|
|
# del certificado recarga nginx).
|
|
#
|
|
# No indexación (objetivo doble):
|
|
# 1. 403 en el borde a los rastreadores conocidos, antes de servir nada.
|
|
# 2. Cabecera X-Robots-Tag en TODAS las respuestas (incluidos 4xx/5xx).
|
|
# El bundle también declara <meta name="robots"> y sirve un robots.txt
|
|
# con "Disallow: /" (ver public/robots.txt e index.html).
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
server_name remigracion.jumpingcrab.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/remigracion.jumpingcrab.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/remigracion.jumpingcrab.com/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
root /opt/remigracion/dist;
|
|
index index.html;
|
|
charset utf-8;
|
|
|
|
add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet, noimageindex, notranslate, noai, noimageai" always;
|
|
add_header Referrer-Policy "no-referrer" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
# Rastreadores de buscadores, agregadores SEO y crawlers de IA.
|
|
if ($http_user_agent ~* "(googlebot|google-inspectiontool|bingbot|bingpreview|msnbot|yandex|baiduspider|duckduckbot|slurp|ahrefs|semrush|mj12bot|dotbot|petalbot|applebot|gptbot|ccbot|claudebot|perplexitybot|bytespider|amazonbot)") {
|
|
return 403;
|
|
}
|
|
|
|
# Validación ACME de certbot. Vive fuera del árbol desplegado para que el
|
|
# 'rsync --delete' del deploy no borre el challenge a mitad de una renovación.
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
root /var/www/letsencrypt;
|
|
default_type "text/plain";
|
|
add_header X-Robots-Tag "noindex, nofollow" always;
|
|
}
|
|
|
|
# robots.txt generado aquí mismo: el deploy no depende del build para esto.
|
|
location = /robots.txt {
|
|
add_header Content-Type "text/plain; charset=utf-8" always;
|
|
add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet, noimageindex, notranslate, noai, noimageai" always;
|
|
return 200 "User-agent: *\nDisallow: /\n";
|
|
}
|
|
|
|
# Assets con hash de Vite: cacheables para siempre.
|
|
location /assets/ {
|
|
try_files $uri =404;
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable" always;
|
|
add_header X-Robots-Tag "noindex, nofollow, noarchive, nosnippet, noimageindex, notranslate, noai, noimageai" always;
|
|
}
|
|
|
|
# SPA: cualquier ruta desconocida vuelve al index.
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|