76 lines
2.6 KiB
Nginx Configuration File
Executable File
76 lines
2.6 KiB
Nginx Configuration File
Executable File
server {
|
|
|
|
gzip on;
|
|
gzip_disable "msie6"; # Отключение для IE6 (устаревший браузер)
|
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
|
|
|
|
gzip_min_length 1024;
|
|
|
|
gzip_comp_level 6;
|
|
|
|
gzip_buffers 16 8k;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_vary on;
|
|
|
|
client_max_body_size 200M; # Максимальный размер тела запроса
|
|
large_client_header_buffers 4 128k; # Размеры буферов для заголовков
|
|
|
|
root /var/www/public;
|
|
|
|
location / {
|
|
try_files $uri /index.php?$args; # Обработка запросов
|
|
}
|
|
|
|
location /sveden/ {
|
|
alias /var/www/public/sveden/;
|
|
index index.html;
|
|
try_files $uri $uri/ /sveden/index.html;
|
|
expires epoch;
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
}
|
|
|
|
location = /sveden {
|
|
return 301 /sveden/;
|
|
}
|
|
|
|
location /abitur/ {
|
|
alias /var/www/public/abitur/;
|
|
index index.html;
|
|
try_files $uri $uri/ /abitur/index.html;
|
|
expires epoch;
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
}
|
|
|
|
location = /abitur {
|
|
return 301 /abitur/;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
try_files $uri =404; # Если файл не найден, возвращаем 404
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$; # Разделение пути
|
|
fastcgi_pass app:9000; # Указываем сервер PHP-FPM
|
|
fastcgi_index index.php; # Индексный файл
|
|
include fastcgi_params; # Включаем параметры FastCGI
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Путь к скрипту
|
|
fastcgi_param PATH_INFO $fastcgi_path_info; # Информация о пути
|
|
fastcgi_buffers 16 16k; # Увеличение буферов FastCGI
|
|
fastcgi_buffer_size 32k; # Размер буфера FastCGI
|
|
}
|
|
|
|
# Защита от доступа к конфиденциальным файлам
|
|
location ~ /\.ht {
|
|
deny all; # Запрет доступа к файлам .htaccess
|
|
}
|
|
|
|
# Настройки кэширования для статических файлов
|
|
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|otf)$ {
|
|
expires 30d; # Кэширование на 30 дней
|
|
add_header Cache-Control "public, no-transform"; # Заголовок кэширования
|
|
}
|
|
|
|
|
|
}
|