Add remote development support with Docker Nginx configuration
- Introduce a new `nginx-remote-dev` service in `docker-compose.yaml` for remote development environments, allowing Nginx to proxy requests to the host machine's frontend and backend services. - Create a new Nginx configuration file `ai-video.remote-dev.conf` tailored for remote setups, ensuring proper handling of WebSocket and API requests. - Update `README.md` to include detailed instructions for setting up remote development with Nginx, including certificate generation and service initialization. - Enhance the `setup-certs.sh` script to support additional hostnames for certificate signing, improving flexibility for remote access. - Revise documentation to clarify the development paths and requirements for local and remote environments.
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# 用 mkcert 生成本地受信任 TLS 证书,供 deploy/nginx/ai-video.dev.conf 使用。
|
||||
# 用 mkcert 生成本地受信任 TLS 证书,供开发 nginx 配置使用。
|
||||
#
|
||||
# mkcert 会建一个"本地 CA"并装进系统/浏览器信任库,之后它签的证书在本机零警告。
|
||||
# 局域网里其它设备(手机/别的电脑)要免警告,需把这个 CA 根证书也装到那台设备上
|
||||
# (见末尾提示)。
|
||||
#
|
||||
# 用法: ./deploy/setup-certs.sh
|
||||
# 用法:
|
||||
# ./deploy/setup-certs.sh
|
||||
# ./deploy/setup-certs.sh 192.168.1.20 dev.example.com
|
||||
set -euo pipefail
|
||||
|
||||
CERT_DIR="$(cd "$(dirname "$0")" && pwd)/certs"
|
||||
@@ -23,7 +25,12 @@ echo "▶ 安装/确认本地 CA(mkcert -install)…"
|
||||
mkcert -install
|
||||
|
||||
# 3) 探测本机局域网 IP(其它设备靠这个 IP 访问)
|
||||
LAN_IP="$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || true)"
|
||||
LAN_IP="$(
|
||||
ipconfig getifaddr en0 2>/dev/null \
|
||||
|| ipconfig getifaddr en1 2>/dev/null \
|
||||
|| hostname -I 2>/dev/null | awk '{print $1}' \
|
||||
|| true
|
||||
)"
|
||||
if [ -z "$LAN_IP" ]; then
|
||||
echo "⚠ 没探测到局域网 IP(en0/en1),证书将只覆盖 localhost。"
|
||||
echo " 如需 LAN 访问,手动重跑:mkcert ... <你的IP>"
|
||||
@@ -32,6 +39,9 @@ fi
|
||||
# 4) 签证书:覆盖 localhost / 回环 / 局域网 IP / 一个好记的本地域名
|
||||
HOSTS=(localhost 127.0.0.1 ::1 ai-video.local)
|
||||
[ -n "$LAN_IP" ] && HOSTS+=("$LAN_IP")
|
||||
for extra_host in "$@"; do
|
||||
[ -n "$extra_host" ] && HOSTS+=("$extra_host")
|
||||
done
|
||||
|
||||
echo "▶ 为以下名字签发证书:${HOSTS[*]}"
|
||||
mkcert -cert-file "$CERT_DIR/ai-video.pem" \
|
||||
|
||||
Reference in New Issue
Block a user