commit current project

This commit is contained in:
awei
2025-03-09 16:14:12 +08:00
parent 4e51db4edd
commit 21f4026106
7 changed files with 144 additions and 47 deletions

View File

@@ -19,10 +19,66 @@ localPort = 443
remotePort = 443
[[proxies]]
name = "zerotier"
name = "tailscale3478u"
type = "udp"
localIP = "127.0.0.1"
localPort = 9993
remotePort = 9993
localPort = 3478
remotePort = 3478
[[proxies]]
name = "tailscale3478t"
type = "tcp"
localIP = "127.0.0.1"
localPort = 3478
remotePort = 3478
[[proxies]]
name = "tailscale50443t"
type = "tcp"
localIP = "127.0.0.1"
localPort = 50443
remotePort = 50443
[[proxies]]
name = "tailscale41641u"
type = "udp"
localIP = "127.0.0.1"
localPort = 41641
remotePort = 41641
[[proxies]]
name = "tailscale50443u"
type = "udp"
localIP = "127.0.0.1"
localPort = 50443
remotePort = 50443
[[proxies]]
name = "tailscale12345u"
type = "udp"
localIP = "127.0.0.1"
localPort = 12345
remotePort = 12345
[[proxies]]
name = "tailscale12345"
type = "tcp"
localIP = "127.0.0.1"
localPort = 12345
remotePort = 12345
[[proxies]]
name = "tailscale8881t"
type = "tcp"
localIP = "127.0.0.1"
localPort = 8881
remotePort = 8881
[[proxies]]
name = "tailscale8881u"
type = "udp"
localIP = "127.0.0.1"
localPort = 8881
remotePort = 8881

View File

@@ -0,0 +1,45 @@
server {
listen 443 ssl;
server_name tailscale.deepseak.icu;
ssl_certificate /etc/letsencrypt/live/tailscale.deepseak.icu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tailscale.deepseak.icu/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 5m;
# 匹配 /web 开头的请求
location ^~ /web {
proxy_pass http://localhost:3009;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# ... 原有跨域配置保持不变 ...
}
# 匹配其他请求
location / {
proxy_pass http://localhost:3008;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

View File

@@ -13,7 +13,7 @@ events {
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
@@ -121,7 +121,7 @@ http {
# 增加一个空的server用于申请证书
server {
listen 80;
server_name active.deepseak.icu;
server_name aaa.deepseak.icu;
}
}

View File

@@ -1,27 +0,0 @@
server {
listen 30080;
server_name localhost;
location / {
# 代理配置
proxy_pass http://localhost:3008;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 跨域配置
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
# 处理 OPTIONS 请求
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
}
}

View File

@@ -1,9 +1,17 @@
#!/bin/bash
# 备份并覆盖所有.conf配置文件
for conf in *.conf; do
cp "/etc/nginx/$conf" "/etc/nginx/${conf}.bak" 2>/dev/null || true
cp "$conf" /etc/nginx/
# 创建 conf.d 目录(如果不存在)
mkdir -p /etc/nginx/conf.d
# 备份并覆盖 nginx.conf 文件
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
cp nginx.conf /etc/nginx/
# 备份并覆盖 conf.d 目录下的所有 .conf 文件
for conf in conf.d/*.conf; do
filename=$(basename "$conf")
cp "/etc/nginx/conf.d/$filename" "/etc/nginx/conf.d/${filename}.bak" 2>/dev/null || true
cp "$conf" /etc/nginx/conf.d/
done
# 测试并重载配置
@@ -11,8 +19,12 @@ if nginx -t; then
systemctl reload nginx
echo "配置已生效HTTPS已启用"
else
echo "配置测试失败,正在恢复所有备份"
for conf in *.conf; do
mv -f "/etc/nginx/${conf}.bak" "/etc/nginx/$conf" 2>/dev/null || true
echo "配置测试失败,已恢复备份"
# 恢复 nginx.conf 备份
cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf
# 恢复 conf.d 目录下的所有 .conf 文件备份
for conf in conf.d/*.conf; do
filename=$(basename "$conf")
mv -f "/etc/nginx/conf.d/${filename}.bak" "/etc/nginx/conf.d/$filename" 2>/dev/null || true
done
fi

View File

@@ -38,7 +38,7 @@ grpc_listen_addr: 0.0.0.0:50443
# mode. This is not recommended as the traffic will
# be unencrypted. Only enable if you know what you
# are doing.
grpc_allow_insecure: false
grpc_allow_insecure: true
# The Noise section includes specific configuration for the
# TS2021 Noise protocol
@@ -110,8 +110,8 @@ derp:
ipv6: 2001:db8::1
# List of externally available DERP maps encoded in JSON
urls:
- https://controlplane.tailscale.com/derpmap/default
# urls:
# - https://controlplane.tailscale.com/derpmap/default
# Locally available DERP map files encoded in YAML
#
@@ -144,7 +144,7 @@ database:
type: sqlite
# Enable debug mode. This setting requires the log.level to be set to "debug" or "trace".
debug: false
debug: true
# GORM configuration settings.
gorm:
@@ -396,7 +396,7 @@ logtail:
# Enable logtail for this headscales clients.
# As there is currently no support for overriding the log server in headscale, this is
# disabled by default. Enabling this will make your clients send logs to Tailscale Inc.
enabled: false
enabled: true
# Enabling this option makes devices prefer a random port for WireGuard traffic over the
# default static port 41641. This option is intended as a workaround for some buggy

View File

@@ -14,7 +14,13 @@ services:
ports:
- "3008:8080" # Headscale API端口
- "9090:9090" # Metrics监控端口
- "50443:50443" # DERP中继端口可选若Derper独立部署则无需映射
- "3478:3478" # STUN 端口
- "41641:41641" # DERP中继端口可选若Derper独立部署则无需映射
- "12345:12345" # STUN 端口
- "8881:8881" # DERP 端口
- "50443:50443"
cap_add:
- NET_ADMIN
sysctls:
@@ -45,4 +51,9 @@ services:
- HEADSCALE_API_URL=http://headscale:8080
- HEADSCALE_API_KEY=QC33VFzaUw.u1qwXFap0QpFAQnwkdGuUyvpspL15185A5JnWeFpt_c # Revert to original variable name
ports:
- "8000:8000" # 访问地址http://<服务器IP>:8000/web
- "3009:8000" # 访问地址http://<服务器IP>:8000/web
# common314 5b6ed5947149bc2b6d203da688afa8d5969844af8151302e
# 9900k 734511957cbece2ae36622adf50a8ec6842d08fb771c771d