Files
umbrix/update-server/.htaccess
Umbrix Developer 76a374950f feat: mobile-like window size and always-visible stats
- Changed window size to mobile phone format (400x800)
- Removed width condition for ActiveProxyFooter - now always visible
- Added run-umbrix.sh launch script with icon copying
- Stats cards now display on all screen sizes
2026-01-17 13:09:20 +03:00

108 lines
3.3 KiB
ApacheConf
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.
# Umbrix Update Server - Apache Configuration
# === ЧПУ (Красивые URL) ===
RewriteEngine On
# Редирект с index.php на api.php
RewriteRule ^index\.php$ api.php [L,R=301]
# API endpoints
RewriteRule ^api/latest$ api.php [L,QSA]
RewriteRule ^api/version$ api.php [L,QSA]
# === Безопасность ===
# Запретить доступ к служебным файлам
<FilesMatch "^(latest\.json|\.htaccess|\.git.*|composer\.json|package\.json|README\.md)$">
Order deny,allow
Deny from all
</FilesMatch>
# Разрешить доступ только к API и downloads
<FilesMatch "^(api\.php)$">
Order allow,deny
Allow from all
</FilesMatch>
# Запретить листинг директорий
Options -Indexes
# Запретить выполнение PHP в папке downloads
<Directory "downloads">
php_flag engine off
RemoveHandler .php .phtml .php3
RemoveType .php .phtml .php3
</Directory>
# === CORS Headers ===
<IfModule mod_headers.c>
# Разрешить CORS для API
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type"
# Кеширование для APK файлов
<FilesMatch "\.(apk)$">
Header set Cache-Control "public, max-age=604800"
</FilesMatch>
# Запрет кеширования для API
<FilesMatch "\.(php|json)$">
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "0"
</FilesMatch>
</IfModule>
# === Сжатие ===
<IfModule mod_deflate.c>
# Сжимать JSON и текстовые файлы
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
# НЕ сжимать APK файлы (они уже сжаты)
SetEnvIfNoCase Request_URI \.apk$ no-gzip dont-vary
</IfModule>
# === MIME типы ===
<IfModule mod_mime.c>
AddType application/vnd.android.package-archive .apk
AddType application/json .json
</IfModule>
# === Ограничение размера загрузки ===
<IfModule mod_php7.c>
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 300
php_value max_input_time 300
</IfModule>
# === Защита от инъекций ===
<IfModule mod_rewrite.c>
# Блокировать подозрительные запросы
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ - [F,L]
</IfModule>
# === Логирование ===
<IfModule mod_log_config.c>
# Кастомный формат логов
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" custom
CustomLog logs/access.log custom
</IfModule>
# === Производительность ===
<IfModule mod_expires.c>
ExpiresActive On
# APK файлы кешировать на неделю
ExpiresByType application/vnd.android.package-archive "access plus 7 days"
# API не кешировать
ExpiresByType application/json "access plus 0 seconds"
</IfModule>