新建项目文件夹
mkdir /data/containers/kms_server
文件夹结构:
.
├── build
│ ├── Dockerfile
│ └── vlmcsd-x64-musl
├── docker-compose.yml
└── nginx
├── conf.d
│ ├── cn.conf
│ └── vlmcsd.conf
├── log
└── nginx.conf
5 directories, 6 files
docker-compose.yml:
services:
vlmcsd:
build: ./build
container_name: vlmcsd
restart: always
tty: true
nginx:
image: nginx:latest
container_name: vlmcsd.nginx
restart: always
tty: true
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:rw
- ./nginx/conf.d:/etc/nginx/conf.d:rw
- ./nginx/log:/var/log/nginx:rw
ports:
- 1688:1688/tcp
Dockerfile内容:
FROM alpine:latest
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.nju.edu.cn/g' /etc/apk/repositories && \
apk add --no-cache tzdata
WORKDIR /app
COPY ./vlmcsd-x64-musl .
ENV TZ=Asia/Shanghai
ENTRYPOINT ["/app/vlmcsd-x64-musl","-L","0.0.0.0:1688","-l","/dev/stdout","-d","-v","-c1","-D"]
EXPOSE 1688
nginx/conf.d/vlmcsd.conf:
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"';
access_log /var/log/nginx/vlmcsd.log proxy;
limit_conn_zone $binary_remote_addr zone=rueoef:10m;
upstream seeeanhhe {
hash $remote_addr consistent;
server vlmcsd:1688;
}
geo $gsswqeehhorgs {
default 0;
192.168.0.0/16 1;
10.0.0.0/8 1;
172.16.0.0/12 1;
include conf.d/cn.conf;
}
map $gsswqeehhorgs $gsswqeehhorgs_flag {
default 127.0.0.36:31680;
1 seeeanhhe;
CN seeeanhhe;
}
server {
listen 1688;
limit_conn rueoef 3;
proxy_pass $gsswqeehhorgs_flag;
set_real_ip_from 192.168.0.0/16;
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
}
}
nginx/conf.d/cn.conf:
1.0.1.0/24 CN;
1.0.2.0/23 CN;
1.0.8.0/21 CN;
1.0.32.0/19 CN;
1.1.0.0/24 CN;
1.1.2.0/23 CN;
1.1.4.0/22 CN;
1.1.8.0/24 CN;
1.1.9.0/24 CN;
1.1.10.0/23 CN;
......
vlmcsd-x86-musl-static-threads下载地址:
https://github.com/Wind4/vlmcsd/releases/download/svn1113/binaries.tar.gz
Categories:
docker与kubernetes