Add nginx setup script

This commit is contained in:
2026-05-26 19:43:27 +00:00
parent bd76824c2a
commit c8116a326e
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# Setup Nginx + SSL for AfakZaid RAG
# Usage: bash scripts/setup-nginx.sh rag.anasouri.com
set -e
DOMAIN="${1:-rag.example.com}"
apt-get install -y nginx certbot python3-certbot-nginx -qq
cat > /etc/nginx/sites-available/rag << NGINX
server {
listen 80;
server_name ${DOMAIN};
location / {
proxy_pass http://localhost:8100;
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;
client_max_body_size 100M;
proxy_read_timeout 300s;
proxy_connect_timeout 300s;
}
}
NGINX
ln -sf /etc/nginx/sites-available/rag /etc/nginx/sites-enabled/rag
nginx -t && systemctl reload nginx
certbot --nginx -d ${DOMAIN} --non-interactive --agree-tos -m admin@${DOMAIN} \
|| echo "SSL failed — ensure DNS A record points to this server first"
echo "Done: https://${DOMAIN}"