Add nginx deploy config and deploy script

This commit is contained in:
seven
2026-06-27 23:15:31 +08:00
parent 4a99724427
commit b51c22c318
2 changed files with 69 additions and 0 deletions

20
deploy/deploy.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Deploy static site to the VPS at 82.156.24.101 over rsync+ssh.
# Run from the project root: ./deploy/deploy.sh
set -euo pipefail
SERVER="ubuntu@82.156.24.101"
REMOTE_ROOT="/var/www/abigail"
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "→ Syncing files to $SERVER:$REMOTE_ROOT"
rsync -avz --delete \
--include='index.html' \
--include='abigail_*.html' \
--exclude='*' \
"$PROJECT_ROOT/" "$SERVER:$REMOTE_ROOT/"
echo "→ Reloading nginx"
ssh "$SERVER" "sudo nginx -t && sudo systemctl reload nginx"
echo "✓ Live at https://82.156.24.101:8093/"

49
deploy/nginx_abigail.conf Normal file
View File

@@ -0,0 +1,49 @@
server {
listen 8093 ssl http2;
listen [::]:8093 ssl http2;
server_name _;
ssl_certificate /etc/nginx/ssl/abigail.crt;
ssl_certificate_key /etc/nginx/ssl/abigail.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
root /var/www/abigail;
index index.html;
# Security headers
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=63072000" always;
# Gzip
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml;
# Short URL routes (mirror vercel.json)
location = /pricing { try_files /abigail_pricing.html =404; }
location = /individuals { try_files /abigail_individuals.html =404; }
location = /employers { try_files /abigail_employers.html =404; }
location = /library { try_files /abigail_library.html =404; }
# cleanUrls: serve foo.html when /foo requested
location / {
try_files $uri $uri.html $uri/ =404;
}
# Deny access to dotfiles
location ~ /\. {
deny all;
}
# Light caching for HTML, longer for assets if/when added
location ~* \.(html)$ {
add_header Cache-Control "public, max-age=300, must-revalidate";
}
}