小编lee*_*way的帖子

Nginx proxy_pass到Minecraft服务器

我试图在两个不同的端口上的同一台机器上运行两个Minecraft服务器.我想基于子域引用它们:

one.example.com -> <minecraft>:25500
two.example.com -> <minecraft>:25501
Run Code Online (Sandbox Code Playgroud)

我以前曾经使用过nginx这样的东西,但它不适用于Minecraft.它以http状态400响应.以下是我日志中的示例:

192.168.0.1 - - [21/Apr/2013:17:25:40 -0700] "\x02<\x00\x0E\x00t\x00h\x00e\x00s\x00a\x00n\x00d\x00y\x00m\x00a\x00n\x001\x002\x003\x00\x1C\x00t\x00e\x00s\x00t\x00.\x00r\x00y\x00a\x00n\x00s\x00a\x00n\x00d\x00y\x00.\x00i\x00s\x00-\x00a\x00-\x00g\x00e\x00e\x00k\x00.\x00c\x00o\x00m\x00\x00c\xDD" 400 173 "-" "-"
Run Code Online (Sandbox Code Playgroud)

这是我的nginx配置:

upstream mine1 {
  server 127.0.0.1:25500;
}
upstream mine2 {
  server 127.0.0.1:25501;
}

server {
  listen 25565;
  server_name one.example.com;

  access_log /var/log/nginx/one.access;
  error_log /var/log/nginx/one.error;

  location / {
    proxy_pass http://mine1;
  }
}
server {
  listen 25565;
  server_name two.example.com;

  access_log /var/log/nginx/two.access;
  error_log /var/log/nginx/two.error;

  location / {
    proxy_pass http://mine2;
  }
}
Run Code Online (Sandbox Code Playgroud)

如果我正确读取这个,nginx响应400.我的猜测是Minecraft客户端没有发送有效的HTTP标头,而Nginx正在抛出请求.但我完全不知所措.任何帮助,将不胜感激.

nginx minecraft

6
推荐指数
2
解决办法
8600
查看次数

标签 统计

minecraft ×1

nginx ×1