Check your kernel version >= 4.9
uname -a
Enable BBR
sysctl -w net.core.default_qdisc=fq
sysctl -w net.ipv4.tcp_congestion_control=bbr
sysctl -w net.ipv4.tcp_notsent_lowat=16384
sysctl -p
Add stream config to /etc/nginx/nginx.conf
stream {
include /etc/nginx/tcp.d/*.conf;
}
Create a new config for Minecraft server
upstream [YOUR_MINECRAFT_SERVER] {
server [YOUR_MINECRAFT_SERVER]:[PORT];
}
server {
listen [PORT];
proxy_pass [YOUR_MINECRAFT_SERVER];
}
Test Nginx config
nginx -t
Reload Nginx
nginx -s reload
Optional: Add DNS SRV record
Name _minecraft._tcp.[YOUR_MINECRAFT_SERVER].tld
Priority [0-65535]
Weight [0-65535]
Port [PORT]
Value [YOUR_MINECRAFT_SERVER]