From d81c9b8ebbcb6956cb7322100976d4fbd9141bd6 Mon Sep 17 00:00:00 2001 From: KtKID <649693008@qq.com> Date: Sat, 8 Apr 2023 16:47:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_run.sh | 22 ++++++++++++++++------ conf/nginx/nginx.conf | 7 ++++++- run.sh | 8 +++++--- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/build_run.sh b/build_run.sh index e8b3592..4a02eb2 100755 --- a/build_run.sh +++ b/build_run.sh @@ -10,19 +10,29 @@ else docker build -t docker-nginx-v2ray . - SITE_DOMAIN="domain" #你的域名 - SSL_PORT=13431 + SITE_DOMAIN="kingkid.fun" #你的域名 + SSL_PORT_START=50000 #start-end受限于nginx最大连接数量 + SSL_PORT_END=50010 V2RAY_PORT=54321 + + port_flags="" + for((i=$SSL_PORT_START; i<$SSL_PORT_END; i++)) + do + port_flags+="-p $i:$i " + done + echo "ssl port is $port_flags" + docker container run \ -d \ --name nginx-v2ray \ + $port_flags \ -p ${V2RAY_PORT}:${V2RAY_PORT} \ - -p ${SSL_PORT}:${SSL_PORT} \ -v "/etc/letsencrypt/archive/${SITE_DOMAIN}":/data/cert/${SITE_DOMAIN} \ -e SITE_DOMAIN="${SITE_DOMAIN}" \ - -e V2RAY_TOKEN="0000000-0000-0000-000-000000" \ + -e V2RAY_TOKEN="981e3a35-ee2c-4b78-874b-ec8acf87edc2" \ -e V2RAY_PORT=${V2RAY_PORT} \ - -e SSL_PORT=${SSL_PORT} \ - -e V2RAY_WS_PATH=/king \ + -e SSL_PORT_START=${SSL_PORT_START} \ + -e SSL_PORT_END=${SSL_PORT_END} \ + -e V2RAY_WS_PATH=/xxx \ docker-nginx-v2ray fi \ No newline at end of file diff --git a/conf/nginx/nginx.conf b/conf/nginx/nginx.conf index 2de8dd5..c0f5c15 100644 --- a/conf/nginx/nginx.conf +++ b/conf/nginx/nginx.conf @@ -1,5 +1,10 @@ + # Listen on ports 5000-60000 and SSL_PORT-60000 for SSL + ${INSERT_HERE} + listen ${SSL_PORT}-60000 ssl default_server; + listen 5000-60000 ssl default_server; + server { - listen ${SSL_PORT} ssl default_server; + listen ${SSL_PORT_START}-${SSL_PORT_END} ssl default_server; listen [::]:${SSL_PORT} ssl; server_name ${SITE_DOMAIN}; diff --git a/run.sh b/run.sh index 97ceb16..df4afcf 100755 --- a/run.sh +++ b/run.sh @@ -19,7 +19,8 @@ echo "SITE DOMAIN : ${SITE_DOMAIN}" echo "V2RAY TOKEN : ${V2RAY_TOKEN}" echo "V2RAY WS PATH : ${V2RAY_WS_PATH}" echo "V2RAY_PORT : ${V2RAY_PORT}" -echo "SSL_PORT : ${SSL_PORT}" +echo "SSL_PORT_START : ${SSL_PORT_START}" +echo "SSL_PORT_END : ${SSL_PORT_END}" DATA_DIR="/data" @@ -73,13 +74,14 @@ start_nginx() { -e "s:\${V2RAY_PORT}:${V2RAY_PORT}:" \ -e "s:\${V2RAY_WS_PATH}:${V2RAY_WS_PATH}:" \ -e "s:\${SITE_DOMAIN}:${SITE_DOMAIN}:" \ - -e "s:\${SSL_PORT}:${SSL_PORT}:" \ + -e "s:\${SSL_PORT_START}:${SSL_PORT_START}:" \ + -e "s:\${SSL_PORT_END}:${SSL_PORT_END}:" \ -e "s:\${CERTIFICATE_FILE}:${CERTIFICATE_FILE}:" \ -e "s:\${CERTIFICATE_KEY_FILE}:${CERTIFICATE_KEY_FILE}:" \ -e "s:\${DHPARAM_FILE}:${DHPARAM_FILE}:" \ /conf/nginx/nginx.conf >${NGINX_CONF} - echo "starting nginx at port ${SSL_PORT}(https)" + echo "starting nginx at port ${SSL_PORT_START}(https)" mkdir -p /run/nginx nginx && echo "nginx started" }