Настройка домена

⚠️ Вам нужно подключить dpc.launcher.ВАШ_ДОМЕН к вашему VPS

Далее вам необходимо создать SSL-сертификат для домена:

sudo apt update
sudo apt install -y certbot
sudo apt install -y python3-certbot-nginx
certbot certonly --nginx -d dpc.launcher.YOUR_DOMAIN

Дождитесь успешного создания SSL-сертификата для вашего домена.

Перейдите в каталог /etc/nginx/sites-enabled и создайте файл dpc.launcher.YOUR_DOMAIN.conf

Поместите в файл следующее содержимое, изменив некоторые параметры:

server {
    listen 80;
    server_name dpc.launcher.YOUR_DOMAIN;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    
    server_name dpc.launcher.YOUR_DOMAIN;
    ssl_certificate /etc/letsencrypt/live/dpc.launcher.YOUR_DOMAIN/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/dpc.launcher.YOUR_DOMAIN/privkey.pem;
    ssl_session_cache shared:SSL:10m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
    ssl_prefer_server_ciphers on;
  location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://SERVER_IP:LAUNCHER_PORT/;
      proxy_buffering off;
  }
  
  location /resources/download/minecraft/net/ {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass https://resources.download.minecraft.net/;
      proxy_buffering off;
  }

  location /files/minecraftforge/net/ {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass https://files.minecraftforge.net/maven/;
      proxy_buffering off;
      proxy_set_header Host files.minecraftforge.net;
      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_ssl_server_name on;
      proxy_ssl_protocols TLSv1.3;
  }

  location /maven/minecraftforge/net/ {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass https://maven.minecraftforge.net/;
      proxy_buffering off;
      proxy_set_header Host maven.minecraftforge.net;
      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_ssl_server_name on;
      proxy_ssl_protocols TLSv1.3;
  }

  location /files/minecraftforge/net/site/ {
      proxy_pass https://files.minecraftforge.net/;
      proxy_buffering off;
      proxy_set_header Host files.minecraftforge.net;
      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_ssl_server_name on;
      proxy_ssl_protocols TLSv1.3;
  }

  location /libraries/minecraft/net/ {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass https://libraries.minecraft.net/;
      proxy_buffering off;
  }
  
  location /launchermeta/mojang/com/ {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass https://launchermeta.mojang.com/;
      proxy_buffering off;
  }
}

Замените параметры YOUR_DOMAIN, SERVER_IP, LAUNCHER_PORT на необходимые

Сохраните файл, а затем зайдите в консоль и введите:

systemctl restart nginx

Last updated