Files
web-alterflixhub/docker/default.conf.template
T
Bkk1234 82374ebfdd fix(scroll): mouse wheel did not scroll the page
main.agent-native-app-main is a scroll container (overflow-y:auto +
overscroll-contain) whose content equals its own height, so it swallowed the
wheel and the document never scrolled; the site wrapper's overflow-x:hidden
also made its overflow-y compute to auto. Neutralise both scrollers so the
document is the only scroller (overflow-x:clip keeps horizontal clipping).

Cache safety: the patched CSS kept its old hashed filename, and nginx served
/assets/* as immutable for a year, so visitors with the earlier CSS could
never receive the fix. Renamed the stylesheet to a content hash and updated
34 HTML references, switched /assets/ to no-cache (revalidate, 304), bumped
sw.js VERSION to v2.1.2. docs/deploy-dokploy.md updated.
2026-11-22 22:52:17 +07:00

88 lines
4.7 KiB
Plaintext

# server ของ static export — ไฟล์ config นี้เป็น template
# nginx official entrypoint จะแทนค่า env (${PORT}, ${PUBLIC_ORIGIN}) ให้ตอนสตาร์ท
# ตัวแปรของ nginx ($uri, $host, ...) ไม่ถูกแทน เพราะ envsubst จำกัดเฉพาะชื่อ env ที่มีจริง
server {
listen ${PORT};
listen [::]:${PORT};
server_name _;
root /usr/share/nginx/html;
index index.html;
charset utf-8;
server_tokens off;
# ── http → https ──────────────────────────────────────────────────────
# Dokploy/Traefik ต่อเข้ามาเป็น http ภายในแล้วแนบ X-Forwarded-Proto มาให้
# ถ้าเป็น "http" = ผู้ใช้เข้ามาทาง http → 301 ไป https เสมอ (path + query เดิม)
if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}
# ── response headers (ชุดเดียวกับทุก location — ดู docker/security-headers.conf)
include snippets/security-headers.conf;
# ── compression ──────────────────────────────────────────────────────
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_min_length 512;
gzip_proxied any;
gzip_types text/plain text/css text/xml application/javascript application/json
application/xml application/manifest+json image/svg+xml;
# ── healthcheck (ไม่ถูก redirect, ไม่ลง log) ──────────────────────────
location = /healthz {
access_log off;
default_type text/plain;
include snippets/security-headers.conf;
return 200 "ok\n";
}
# ── service worker / manifest: ห้าม cache ยาว (ต้องได้ตัวใหม่ทันที) ──
location = /sw.js {
add_header Cache-Control "no-cache" always;
include snippets/security-headers.conf;
try_files $uri =404;
}
location = /manifest.json {
add_header Cache-Control "no-cache" always;
include snippets/security-headers.conf;
try_files $uri =404;
}
# ── asset JS/CSS/FONT: revalidate ทุกครั้ง (ไม่ใช้ immutable) ──────────
# ในโหมด publish static export เรามัก patch ไฟล์ใน /assets/ ด้วยมือโดยชื่อไฟล์เดิม
# → ถ้า cache ยาว เครื่องที่เคยโหลดจะค้างไฟล์เก่าเป็นปี (เคสจริง: CSS scroll/wheel fix ไม่ถึงผู้ใช้)
# no-cache = ยังแคชได้ แต่ revalidate ทุกครั้ง (304 ราคาถูก) · ไฟล์ที่มี hash ใหม่จะถูกโหลดทันที
location /assets/ {
include snippets/security-headers.conf;
add_header Cache-Control "no-cache" always;
try_files $uri =404;
}
# ── รูป/ฟอนต์: cache 30 วัน ───────────────────────────────────────────
location ~* \.(?:png|jpe?g|webp|avif|gif|svg|ico|woff2?|ttf)$ {
add_header Cache-Control "public, max-age=2592000" always;
include snippets/security-headers.conf;
try_files $uri =404;
}
# ── หน้าเว็บ: clean URL ───────────────────────────────────────────────
# /cinema/<slug> → /cinema/<slug>/index.html โดย "ไม่" redirect ไปเติม /
# (canonical ที่อบไว้ไม่มี trailing slash — ต้องตรงกัน)
location / {
add_header Cache-Control "no-cache" always;
include snippets/security-headers.conf;
try_files $uri $uri/index.html $uri/ =404;
}
# ── 404 ──────────────────────────────────────────────────────────────
error_page 404 /404.html;
location = /404.html {
internal;
include snippets/security-headers.conf;
add_header Cache-Control "no-store" always;
}
}