init
This commit is contained in:
48
nginx.conf
Normal file
48
nginx.conf
Normal file
@ -0,0 +1,48 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Сжатие для лучшей производительности
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
# Кэширование статических ресурсов
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Для SPA - все маршруты направляем на index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
# Заголовки безопасности
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
}
|
||||
|
||||
# API endpoint для получения информации о пользователе
|
||||
location /api/user {
|
||||
# В реальном приложении здесь будет проксирование к backend
|
||||
# Для демо возвращаем информацию из заголовков OAuth2 proxy
|
||||
add_header Content-Type application/json;
|
||||
return 200 '{"name": "Демо Пользователь", "email": "demo@example.com"}';
|
||||
}
|
||||
|
||||
# Health check endpoint
|
||||
location /health {
|
||||
add_header Content-Type application/json;
|
||||
return 200 '{"status": "ok"}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user