- .forgejo/workflows/ci.yml: npm run verify nel container Playwright a ogni push su main e pull request, report come artifact, link esterni non bloccanti - .forgejo/workflows/release.yml: ai tag vX.Y.Z verifica, pacchetto e pubblicazione nella sezione Release con forgejo-release (token FORGEJO_TOKEN) - scripts/package.mjs: zip e tar.gz riproducibili, SHA256SUMS.txt, BUILD-INFO.txt - scripts/check-package.mjs: confronto 1:1 con dist/, impronte, sha256sum -c - scripts/changelog-notes.mjs e release-upload.sh (API REST di Forgejo) - deploy/: nginx.conf.example, gestore PHP del modulo, esempio di deploy automatico (rsync, FTPS, rclone) non attivo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016zJ9ZWGKvoKoxYwbmnRKdJ
113 lines
5.1 KiB
Plaintext
113 lines
5.1 KiB
Plaintext
# =============================================================================
|
|
# Studio Grasso — configurazione nginx di esempio (equivalente a public/.htaccess)
|
|
# -----------------------------------------------------------------------------
|
|
# 1. Estrarre il pacchetto sito-studio-grasso-vX.Y.Z.tar.gz in /var/www/studio-grasso
|
|
# 2. Copiare questo file in /etc/nginx/sites-available/studio-grasso, adattare
|
|
# server_name e certificati, attivarlo e ricaricare: nginx -t && systemctl reload nginx
|
|
# 3. Il file .htaccess incluso nel pacchetto è ignorato da nginx (ed è bloccato qui sotto).
|
|
# Richiede nginx ≥ 1.25.1 per la direttiva «http2 on;»; con versioni precedenti eliminarla e
|
|
# scrivere «listen 443 ssl http2;». Configurazione verificata con `nginx -t`.
|
|
# =============================================================================
|
|
|
|
# HTTP → HTTPS
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name www.grassoezio.it grassoezio.it;
|
|
return 301 https://www.grassoezio.it$request_uri;
|
|
}
|
|
|
|
# Dominio senza «www» → con «www» (coerente con SITE_URL; invertire se si usa il dominio senza www)
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name grassoezio.it;
|
|
ssl_certificate /etc/letsencrypt/live/grassoezio.it/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/grassoezio.it/privkey.pem;
|
|
return 301 https://www.grassoezio.it$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name www.grassoezio.it;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/grassoezio.it/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/grassoezio.it/privkey.pem;
|
|
|
|
root /var/www/studio-grasso;
|
|
index index.html;
|
|
charset utf-8;
|
|
server_tokens off;
|
|
|
|
# --- header di sicurezza (come .htaccess, brief §9.4) ---
|
|
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; font-src 'self'; frame-src https://www.google.com; form-action 'self'; base-uri 'self'; frame-ancestors 'self'" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Permissions-Policy "accelerometer=(), autoplay=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), usb=(), browsing-topics=()" always;
|
|
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
|
# HSTS: attivare solo quando HTTPS è certo su tutto il dominio.
|
|
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
# --- compressione ---
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_comp_level 6;
|
|
gzip_types text/css text/plain text/xml application/xml application/javascript image/svg+xml application/ld+json;
|
|
|
|
# --- pagine e 404 ---
|
|
# /studio → /studio/ è automatico (try_files su una cartella con index.html).
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
add_header Cache-Control "no-cache";
|
|
# ripetuti perché add_header in un blocco location sostituisce quelli del server
|
|
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; font-src 'self'; frame-src https://www.google.com; form-action 'self'; base-uri 'self'; frame-ancestors 'self'" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header Permissions-Policy "accelerometer=(), autoplay=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), usb=(), browsing-topics=()" always;
|
|
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
|
}
|
|
error_page 404 /404.html;
|
|
location = /404.html {
|
|
internal;
|
|
}
|
|
|
|
# vecchio indirizzo della privacy policy
|
|
location = /privacy {
|
|
return 301 /privacy-policy/;
|
|
}
|
|
|
|
# file con impronta nel nome (cartella /_astro/): cache di un anno
|
|
location /_astro/ {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# icone, immagine di condivisione, sitemap, robots.txt: una settimana
|
|
location ~* ^/(favicon\.(ico|svg)|apple-touch-icon\.png|og-default\.png|robots\.txt|sitemap.*\.xml)$ {
|
|
add_header Cache-Control "public, max-age=604800";
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# file nascosti (tranne /.well-known/ per i certificati) e mappe dei sorgenti
|
|
location ~ /\.(?!well-known/) {
|
|
deny all;
|
|
return 404;
|
|
}
|
|
location ~* \.map$ {
|
|
deny all;
|
|
return 404;
|
|
}
|
|
|
|
# Modulo di contatto in PHP (solo con contactForm.mode = "php", vedi docs/DEPLOY.md):
|
|
# location = /contact.php {
|
|
# include snippets/fastcgi-php.conf;
|
|
# fastcgi_pass unix:/run/php/php8.3-fpm.sock;
|
|
# }
|
|
}
|