Files
thumbnail-tinder/deploy/nginx.conf
T
IgorVolochayandClaude Sonnet 5.5 1263aade8b Add links to extension and live site, shrink sample CSV
Replace the 822-row sample with a 6-row example.csv. Link the Outlier Saver
extension from the README and both empty screens. Set nginx server_name to
outliers.viaproger.ru.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 22:51:15 +03:00

82 lines
3.5 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Thumbnail Tinder: static site.
#
# Куда положить: /etc/nginx/sites-available/thumbnail-tinder
# (затем ссылка в sites-enabled; на RHEL-подобных системах просто /etc/nginx/conf.d/thumbnail-tinder.conf).
# Домен по умолчанию: outliers.viaproger.ru. Для другого домена замените server_name.
# HTTPS добавляется одной командой после запуска: sudo certbot --nginx -d <домен>
# (подробности в README.md, раздел «Развёртывание»).
server {
listen 80;
listen [::]:80;
server_name outliers.viaproger.ru;
root /var/www/thumbnail-tinder;
index index.html;
charset utf-8;
access_log /var/log/nginx/thumbnail-tinder.access.log;
error_log /var/log/nginx/thumbnail-tinder.error.log;
# Приложение только отдаёт статику.
if ($request_method !~ ^(GET|HEAD)$) {
return 405;
}
# ---------- Сжатие ----------
gzip on;
gzip_comp_level 5;
gzip_min_length 512;
gzip_vary on;
gzip_types text/css text/plain application/javascript application/json image/svg+xml;
# text/html сжимается по умолчанию
# ---------- Заголовки безопасности ----------
# Страницам нужны: шрифты с Google Fonts и превью с i.ytimg.com.
# Скрипты и стили встроены в HTML, поэтому разрешён 'unsafe-inline'.
# connect-src 'none': приложение не делает сетевых запросов, файл CSV читается локально в браузере.
# Важно: add_header в location сбрасывает унаследованные заголовки,
# поэтому ниже в location используется только expires.
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; img-src 'self' data: https://i.ytimg.com; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "no-referrer" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
# ---------- Маршруты: белый список ----------
# Отдаются только три файла приложения. Всё остальное (в том числе случайно
# скопированные CSV, .git, README) отвечает 404.
location = / {
try_files /index.html =404;
expires epoch; # Cache-Control: no-cache, страница всегда свежая
}
location = /index.html {
expires epoch;
}
location = /liked.html {
expires epoch;
}
location = /style.css {
expires 1h; # файл без хеша в имени, поэтому кэш короткий
}
location = /favicon.ico {
access_log off;
return 204;
}
# Для certbot (если используется метод webroot, а не --nginx)
location ^~ /.well-known/acme-challenge/ {
root /var/www/certbot;
default_type text/plain;
}
location / {
return 404;
}
}