-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfix_caddy_gitea.sh
More file actions
37 lines (32 loc) · 931 Bytes
/
fix_caddy_gitea.sh
File metadata and controls
37 lines (32 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Add Gitea config to Caddyfile and reload
CADDYFILE="/home/alex/caddy_terraphim/conf/Caddyfile_auth"
# Backup current config
cp "$CADDYFILE" "$CADDYFILE.bak.$(date +%Y%m%d-%H%M%S)"
# Check if git.terraphim.cloud is already configured
if ! grep -q "git.terraphim.cloud" "$CADDYFILE"; then
cat >> "$CADDYFILE" << 'EOF'
# Gitea Git Server
git.terraphim.cloud {
import tls_config
reverse_proxy localhost:3000 {
header_up X-Real-IP {remote_host}
header_up X-Forwarded-For {remote_host}
header_up X-Forwarded-Proto {scheme}
}
log {
output file /home/alex/caddy_terraphim/log/git.log {
roll_size 10MiB
roll_keep 10
roll_keep_for 336h
}
}
}
EOF
echo "Added git.terraphim.cloud configuration"
# Reload Caddy
cd /home/alex/caddy_terraphim && ./caddy reload --config conf/Caddyfile_auth
echo "Caddy reloaded successfully"
else
echo "git.terraphim.cloud already configured"
fi