Files
laravel-gost-template/deploy/nginx/app.conf
2026-06-24 17:20:43 +09:00

68 lines
2.9 KiB
Plaintext
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.

# ============================================================================
# Пример конфигурации Nginx для защищённого Laravel-приложения (УЗ-1 / К1)
# Меры ФСТЭК: ЗИС.9 (TLS), ЗИС (заголовки), ЗИС.2 (защита периметра).
# Подставьте домен, пути к сертификатам и при необходимости — ГОСТ TLS.
# ============================================================================
# Ограничение частоты запросов к форме входа (защита от перебора, ИАФ.6).
limit_req_zone $binary_remote_addr zone=login:10m rate=10r/m;
server {
listen 80;
server_name example.local;
# Принудительный редирект на HTTPS (ЗИС.9).
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
http2 on;
server_name example.local;
root /var/www/app/public;
index index.php;
# ---- TLS (ЗИС.9). Только TLS 1.2/1.3 ----------------------------------
ssl_certificate /etc/ssl/app/fullchain.pem;
ssl_certificate_key /etc/ssl/app/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
# Для государственных ИС: ГОСТ TLS через КриптоПро (ЗИС.16) — модуль
# nginx с поддержкой ГОСТ-шифронаборов либо stunnel/КриптоПро.
# ---- Заголовки безопасности (дублируют middleware приложения) ---------
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
server_tokens off;
# ---- Ограничение размера загрузок (ЗИС, защита от исчерпания ресурсов) -
client_max_body_size 10m;
location = /login {
limit_req zone=login burst=5 nodelay;
try_files $uri /index.php?$query_string;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_hide_header X-Powered-By;
}
# Запрет доступа к служебным и скрытым файлам.
location ~ /\.(?!well-known).* { deny all; }
location ~ /(storage|bootstrap|config|database|tests)/ { deny all; }
}