Update k8s/games/minecraft/deployments.yaml
All checks were successful
Check with kubeconform / lint (push) Successful in 11s
All checks were successful
Check with kubeconform / lint (push) Successful in 11s
This commit is contained in:
@@ -6,12 +6,24 @@ metadata:
|
|||||||
namespace: minecraft
|
namespace: minecraft
|
||||||
data:
|
data:
|
||||||
nginx.conf: |
|
nginx.conf: |
|
||||||
|
# Запуск рабочих процессов от имени пользователя nginx
|
||||||
user nginx;
|
user nginx;
|
||||||
|
# Рекомендуется ставить worker_processes auto; но 1 тоже будет работать
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
# --- ИСПРАВЛЕНИЯ И ОПТИМИЗАЦИЯ ---
|
||||||
|
# Включаем sendfile для быстрой отдачи файлов напрямую из файловой системы
|
||||||
|
sendfile on;
|
||||||
|
# Оптимизирует отправку пакетов, используется вместе с sendfile
|
||||||
|
tcp_nopush on;
|
||||||
|
# --- КОНЕЦ ИСПРАВЛЕНИЙ ---
|
||||||
|
|
||||||
|
# Определяем MIME-типы файлов, чтобы браузер знал, как их обрабатывать
|
||||||
types {
|
types {
|
||||||
application/zip zip;
|
application/zip zip;
|
||||||
text/html html htm;
|
text/html html htm;
|
||||||
@@ -20,29 +32,33 @@ data:
|
|||||||
image/png png;
|
image/png png;
|
||||||
image/jpeg jpg jpeg;
|
image/jpeg jpg jpeg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Тип по умолчанию для всех остальных файлов
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
|
# Этот блок остается без изменений для вашего основного сайта
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://localhost:8123;
|
proxy_pass http://localhost:8123;
|
||||||
sub_filter 'Minecraft Dynamic Map' "Hexor's MC server";
|
sub_filter 'Minecraft Dynamic Map' "Hexor's MC server";
|
||||||
sub_filter "</body>" '<p style="background-color: #CEC6CB; color: black; padding: 10px 10px; text-align: center; font-size: large; text-decoration: none; display: inline-block; border-radius: 4px; position: absolute; top: 10px; left: 150px;">Get <a href="https://github.com/PrismLauncher/PrismLauncher/releases/tag/8.4" >Prism Launcher</a> and <a href="/clients/1.12.2.zip" >client.zip</a> for this server. Server address <b>minecraft.hexor.cy:30565</b></p></body>';
|
sub_filter "</body>" '<p style="background-color: #CEC6CB; color: black; padding: 10px 10px; text-align: center; font-size: large; text-decoration: none; display: inline-block; border-radius: 4px; position: absolute; top: 10px; left: 150px;">Get <a href="https://github.com/PrismLauncher/PrismLauncher/releases/tag/8.4" >Prism Launcher</a> and <a href="/clients/1.12.2.zip" >client.zip</a> for this server. Server address <b>minecraft.hexor.cy:30565</b></p></body>';
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --- УПРОЩЕННЫЙ БЛОК ДЛЯ СКАЧИВАНИЯ ФАЙЛОВ ---
|
||||||
|
# Этот блок теперь корректно и эффективно обрабатывает все файлы в /clients/
|
||||||
location /clients/ {
|
location /clients/ {
|
||||||
|
# Указываем реальный путь к файлам на сервере
|
||||||
alias /mc/clients/;
|
alias /mc/clients/;
|
||||||
|
|
||||||
|
# Показывает список файлов, если запрошена сама директория
|
||||||
autoindex on;
|
autoindex on;
|
||||||
|
|
||||||
location ~* \.zip$ {
|
# Добавляем заголовок, чтобы браузер всегда предлагал скачать файл,
|
||||||
sendfile off;
|
# а не пытался его открыть. Это применится ко всем файлам в /clients/
|
||||||
|
add_header Content-Disposition "attachment";
|
||||||
add_header Content-Type application/zip;
|
|
||||||
add_header Content-Disposition "attachment";
|
|
||||||
add_header Accept-Ranges bytes;
|
|
||||||
|
|
||||||
try_files $uri =404;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user