-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsetup-nginx.sh
More file actions
50 lines (43 loc) · 1.78 KB
/
setup-nginx.sh
File metadata and controls
50 lines (43 loc) · 1.78 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# =============================================================================
# OpenVoiceUI — quick nginx config for a single domain
#
# For a full setup (SSL, systemd service, www dirs) use setup-sudo.sh instead.
# This script is for manual nginx-only configuration.
#
# Edit DOMAIN, PORT, and EMAIL before running.
# Run as: sudo bash setup-nginx.sh
# =============================================================================
DOMAIN="your-domain.com" # ← EDIT: your actual domain
PORT=5001 # ← match PORT in your .env (default: 5001)
EMAIL="your-email@example.com" # ← EDIT: for Let's Encrypt notifications
# Guard: refuse to run with placeholder values
if [ "$DOMAIN" = "your-domain.com" ] || [ "$EMAIL" = "your-email@example.com" ]; then
echo "ERROR: Edit DOMAIN and EMAIL at the top of this script before running."
exit 1
fi
cat << NGINX | sudo tee /etc/nginx/sites-available/${DOMAIN}
server {
listen 80;
listen [::]:80;
server_name ${DOMAIN};
location / {
proxy_pass http://127.0.0.1:${PORT};
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;
proxy_cache_bypass \$http_upgrade;
proxy_read_timeout 86400;
}
client_max_body_size 100M;
}
NGINX
sudo ln -sf /etc/nginx/sites-available/${DOMAIN} /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d ${DOMAIN} --non-interactive --agree-tos -m ${EMAIL}
echo ""
echo "Done. OpenVoiceUI accessible at https://${DOMAIN}"