Skip to content

Instantly share code, notes, and snippets.

@unchama
Last active May 18, 2019 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unchama/ff6e5f98e80fdf4c063008681ed5f6af to your computer and use it in GitHub Desktop.
Save unchama/ff6e5f98e80fdf4c063008681ed5f6af to your computer and use it in GitHub Desktop.
nukkit+nginxのdocker-composeをたててnginx reverse proxy経由でnukkitへ
worker_processes 2;
events {
worker_connections 1024;
}
stream {
log_format proxy '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time "$upstream_addr" '
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
upstream minecraft_udp_upstreams {
server ${MINECRAFT_PORT_19132_UDP_ADDR}:19132;
}
server {
error_log /var/log/nginx/error.log debug;
access_log /var/log/nginx/access.log proxy buffer=32k;
listen 19132 udp;
proxy_pass minecraft_udp_upstreams;
proxy_timeout 60s;
}
}
version: '3.3'
networks:
nukkit-test:
external: false
services:
# nukkitサーバー本体のコンテナ
mc-nukkit:
image: ixilon/nukkit:latest
environment:
- TZ=Asia/Tokyo
volumes:
- ./nukkit-data:/srv/nukkit
networks:
- nukkit-test
# nginx-proxy
nginx-proxy:
image: nginx
environment:
- MINECRAFT_PORT_19132_UDP_ADDR=mc-nukkit
ports:
# ホストアドレス:19132/udp でアクセス可能とする
- 19132:19132/udp
networks:
- nukkit-test
depends_on:
- mc-nukkit
command: /bin/sh -c "envsubst '$$MINECRAFT_PORT_19132_UDP_ADDR' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
volumes:
- ./default.conf.template:/etc/nginx/conf.d/default.conf.template
- ./nginx-log:/var/log/nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment