109 lines
3.8 KiB
Nginx Configuration File
Executable File
109 lines
3.8 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 /jenkins/ {
|
|
proxy_pass http://jenkins:8080;
|
|
proxy_set_header Host $host;
|
|
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;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_read_timeout 90s;
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
}
|
|
|
|
location /static/ {
|
|
proxy_pass http://jenkins:8080;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri /index.php?$args; # Обработка запросов
|
|
}
|
|
|
|
# ========================================================================
|
|
# VIKON MODULE SECURITY — Block executable files in module directories
|
|
# MUST be placed BEFORE location ~ \.php$ to take effect
|
|
# ========================================================================
|
|
|
|
location ~ ^/(sveden|abitur)/.*\.(php|php3|php4|php5|php7|php8|phps|phtml|pl|py|pyc|cgi|sh|bash|bat|cmd|exe|com|ps1|psm1|rb|asp|aspx|jsp|cfm)$ {
|
|
deny all;
|
|
return 403;
|
|
access_log /var/log/nginx/blocked_module_scripts.log;
|
|
}
|
|
|
|
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"; # Заголовок кэширования
|
|
}
|
|
|
|
|
|
}
|