CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
setup-nginx.sh
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 8ade77b | 1 | #!/bin/bash |
| 2 | set -euo pipefail | |
| 3 | ||
| 4 | # ============================================ | |
| 5 | # Nginx + HTTPS setup for gluecron | |
| 6 | # ============================================ | |
| 7 | ||
| 8 | DOMAIN="${1:-gluecron.com}" | |
| 9 | ||
| 10 | echo "Setting up nginx for $DOMAIN..." | |
| 11 | ||
| 12 | # Install nginx + certbot | |
| 13 | sudo apt-get update | |
| 14 | sudo apt-get install -y nginx certbot python3-certbot-nginx | |
| 15 | ||
| 16 | # Create nginx config | |
| 17 | sudo tee /etc/nginx/sites-available/gluecron > /dev/null << NGINX | |
| 18 | server { | |
| 19 | listen 80; | |
| 20 | server_name $DOMAIN www.$DOMAIN; | |
| 21 | ||
| 22 | # Allow large git pushes | |
| 23 | client_max_body_size 500m; | |
| 24 | ||
| 25 | location / { | |
| 26 | proxy_pass http://127.0.0.1:3000; | |
| 27 | proxy_http_version 1.1; | |
| 28 | proxy_set_header Host \$host; | |
| 29 | proxy_set_header X-Real-IP \$remote_addr; | |
| 30 | proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; | |
| 31 | proxy_set_header X-Forwarded-Proto \$scheme; | |
| 32 | ||
| 33 | # Required for git smart HTTP protocol | |
| 34 | proxy_buffering off; | |
| 35 | proxy_request_buffering off; | |
| 36 | ||
| 37 | # Timeouts for large repos | |
| 38 | proxy_connect_timeout 300; | |
| 39 | proxy_send_timeout 300; | |
| 40 | proxy_read_timeout 300; | |
| 41 | } | |
| 42 | } | |
| 43 | NGINX | |
| 44 | ||
| 45 | # Enable site | |
| 46 | sudo ln -sf /etc/nginx/sites-available/gluecron /etc/nginx/sites-enabled/ | |
| 47 | sudo rm -f /etc/nginx/sites-enabled/default | |
| 48 | sudo nginx -t | |
| 49 | sudo systemctl reload nginx | |
| 50 | ||
| 51 | # Get SSL cert | |
| 52 | echo "Getting SSL certificate..." | |
| 53 | sudo certbot --nginx -d "$DOMAIN" -d "www.$DOMAIN" --non-interactive --agree-tos --email "admin@$DOMAIN" || { | |
| 54 | echo "" | |
| 55 | echo "Certbot failed — DNS may not be pointed yet." | |
| 56 | echo "Once DNS is live, run:" | |
| 57 | echo " sudo certbot --nginx -d $DOMAIN -d www.$DOMAIN" | |
| 58 | } | |
| 59 | ||
| 60 | echo "" | |
| 61 | echo "Nginx configured for $DOMAIN" | |
| 62 | echo " HTTP -> HTTPS redirect: automatic (after cert)" | |
| 63 | echo " Proxy -> localhost:3000" | |
| 64 | echo " Max upload: 500MB (for large repos)" |