Home > other >  Nginx proxy_pass to the Minecraft server
Nginx proxy_pass to the Minecraft server

Time:10-02

I tried on two different ports on the two Minecraft server running on the same machine. I think based on subdomains reference them:

One.example.com - & gt; : 25500
Two.example.com - & gt; : 25501

Such thing I've ever used before nginx, but it does not apply to Minecraft. It with HTTP status 400 response. Here is my log example:

192.168.0.1 - [21/Apr/2013:17:25:40-0700] "\ x02 & lt; \ 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" - "" -"

This is my nginx configuration:

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. The error;

The 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;

The location/{
Proxy_pass http://mine2;
}
}

If I read this correctly, nginx response 400. My guess is Minecraft client no valid HTTP headers sent, the nginx is thrown request. But I'm completely at a loss. Any help would be appreciated.

CodePudding user response:

As Dag Nabbit said, Minecraft doesn't speak HTTP server. You usually through NAT to perform this operation. The proxy server need to know the deal, because, as the name implies, it stands for the client. Nginx know various protocols, and not just the HTTP, but Minecraft is not one of them. But, you can write agent module for this agreement, and use of the existing Nginx infrastructure. Because I'm not familiar with the agreement, I can't comment on the advantages of this is better than that of NAT.

CodePudding user response:

Can use stream module
  • Related