Оптимизация для Ubuntu+Traefik
This commit is contained in:
68
nginx.conf.example
Normal file
68
nginx.conf.example
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
# Альтернативная конфигурация для Nginx (если вы используете Nginx вместо Traefik)
|
||||
|
||||
upstream global_it24_app {
|
||||
server localhost:3000;
|
||||
keepalive 64;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ваш-домен.ru www.ваш-домен.ru;
|
||||
|
||||
# Редирект на HTTPS
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name ваш-домен.ru www.ваш-домен.ru;
|
||||
|
||||
# SSL сертификаты (Let's Encrypt)
|
||||
ssl_certificate /etc/letsencrypt/live/ваш-домен.ru/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/ваш-домен.ru/privkey.pem;
|
||||
|
||||
# SSL настройки
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
# Логи
|
||||
access_log /var/log/nginx/global-it24-access.log;
|
||||
error_log /var/log/nginx/global-it24-error.log;
|
||||
|
||||
# Безопасность
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# Основная локация
|
||||
location / {
|
||||
proxy_pass http://global_it24_app;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Кэширование статики
|
||||
location /_next/static {
|
||||
proxy_pass http://global_it24_app;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
}
|
||||
|
||||
# Кэширование изображений
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|svg|webp)$ {
|
||||
proxy_pass https://placehold.co/1200x600/e2e8f0/1e293b?text=Proxy_server_address_for_caching_image_files_with_
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
}
|
||||
|
||||
# Размер загрузки файлов
|
||||
client_max_body_size 10M;
|
||||
}
|
||||
Reference in New Issue
Block a user