YuukiPS/DockerGS

one problem about deploying on nginx

Closed this issue · 4 comments

Hi there, I wanna deploy dockergc on port 23336 and use nginx as reverse-proxy, but end up with login interface cannot respond, and no output in dockergc container. When I use ip address, it can login but cannot get into the game with error code 4206.

docker-compose and nginx config as follows, help!

version: '3'
services:
  mongodb:
    restart: unless-stopped
    image: mongo
    ports:
      - "27018:27017"
    volumes:
      - /data/grasscutter/db:/data/db
  grasscutter:
    restart: unless-stopped
    container_name: dockergc
    image: siakbary/dockergc:ubuntu-dev-5.7
    command: -d 'mongodb://mongodb:27017' -f 'yes'
    volumes:
      - /data/grasscutter/resources:/home/Grasscutter/resources
    ports:
      - "22102:22102/udp"
      - "23336:443"
    depends_on:
      - mongodb
    stdin_open: true
    tty: true
server{
    listen 443 ssl;
    server_name gc.<host>.com;
    ssl_certificate gc.<host>.com_bundle.crt;
    ssl_certificate_key gc.<host>.com.key;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
   
    location / {
	proxy_pass http://localhost:23336;
   }
}

server{
    listen 80;
    server_name gc.<host>.com;
    return 301 https://$host$request_uri;
}

if proxy is running together with server it should be able to use an isolated port try name_containers:443

if proxy is running together with server it should be able to use an isolated port try name_containers:443

which name_containers? (I'm new to proxy and not very familiar orz

And after I log in, it raised "无法连接服务器,请检查网络设置。错误码:4206"

name_containers is an address like "localhost" that can be accessed by any container or server, in your case you can try

server{
    listen 443 ssl;
    server_name gc.<host>.com;
    ssl_certificate gc.<host>.com_bundle.crt;
    ssl_certificate_key gc.<host>.com.key;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
   
    location / {
	proxy_pass http://dockergc:443;
   }
}

server{
    listen 80;
    server_name gc.<host>.com;
    return 301 https://$host$request_uri;
}

or you can try this config
https://github.com/akbaryahya/DockerGC/blob/main/docker-compose_public.yml

thanks, it works!`