diff --git a/rootfs-s6-rc/etc/s6-overlay/s6-rc.d/20-nginx/run b/rootfs-s6-rc/etc/s6-overlay/s6-rc.d/20-nginx/run index d0f2908..611871e 100644 --- a/rootfs-s6-rc/etc/s6-overlay/s6-rc.d/20-nginx/run +++ b/rootfs-s6-rc/etc/s6-overlay/s6-rc.d/20-nginx/run @@ -16,8 +16,14 @@ sed -i "s/REPLACE_SERVER_IP/${SERVER_IP}/g" /usr/share/nginx/html/client.sh sed -i "s/REPLACE_VERSION/${FRPS_VER}/g" /usr/share/nginx/html/client.sh sed -i "s/REPLACE_MAIN_DOMAIN/${FRP_SUBDOMAIN_HOST}/g" /usr/share/nginx/html/client.vbs -sed -i "s/REPLACE_MAIN_DOMAIN/${FRP_SUBDOMAIN_HOST}/g" /usr/share/nginx/html/client.cmd sed -i "s/REPLACE_SERVER_IP/${SERVER_IP}/g" /usr/share/nginx/html/client.vbs sed -i "s/REPLACE_VERSION/${FRPS_VER}/g" /usr/share/nginx/html/client.vbs +# 如果 FRP_SUBDOMAIN_HOST 是 n 开头,先把 default.conf.template 文件中的 `REPLACE_MAIN_DOMAIN_frp_client` 替换成 `\REPLACE_MAIN_DOMAIN_frp_client` +if [[ ${FRP_SUBDOMAIN_HOST} == n* ]]; then + sed -i "s/REPLACE_MAIN_DOMAIN_frp_client/\\\\REPLACE_MAIN_DOMAIN_frp_client/g" /etc/nginx/templates/default.conf.template +fi + +sed -i "s/REPLACE_MAIN_DOMAIN/${FRP_SUBDOMAIN_HOST}/g" /etc/nginx/templates/default.conf.template + exec /docker-entrypoint-nginx.sh nginx -g 'daemon off;' \ No newline at end of file diff --git a/rootfs/etc/nginx/templates/default.conf.template b/rootfs/etc/nginx/templates/default.conf.template index 03008f6..5b273c8 100644 --- a/rootfs/etc/nginx/templates/default.conf.template +++ b/rootfs/etc/nginx/templates/default.conf.template @@ -18,9 +18,9 @@ server { rewrite ^/dash/(.*)$ /static/$1 break; } - # location /client.cmd { - # return 200 "cls && curl -s ${FRP_SUBDOMAIN_HOST}/client.vbs -o %temp%\${FRP_SUBDOMAIN_HOST}_frp_client.vbs && cscript %temp%\${FRP_SUBDOMAIN_HOST}_frp_client.vbs $args\n"; - # } + location /client.cmd { + return 200 "cls && curl -s REPLACE_MAIN_DOMAIN/client.vbs -o %temp%\REPLACE_MAIN_DOMAIN_frp_client.vbs && cscript %temp%\REPLACE_MAIN_DOMAIN_frp_client.vbs $args\n"; + } } server { diff --git a/rootfs/usr/share/nginx/html/client.cmd b/rootfs/usr/share/nginx/html/client.cmd deleted file mode 100644 index 91a222c..0000000 --- a/rootfs/usr/share/nginx/html/client.cmd +++ /dev/null @@ -1 +0,0 @@ -cls && curl -s REPLACE_MAIN_DOMAIN/client.vbs -o %temp%\REPLACE_MAIN_DOMAIN_frp_client.vbs && cscript %temp%\REPLACE_MAIN_DOMAIN_frp_client.vbs $args \ No newline at end of file