qvest-task/docker/nginx/conf.d/gitea.conf
aviyadeveloper 22504b886b feat: Automated Gitea deployment with SSL
- Deployed PostgreSQL 18.4 + Gitea 1.22.6 via Docker Compose
- Configured Nginx reverse proxy with Let's Encrypt SSL
- Created Ansible playbooks for full automation (site.yml)
- Database credentials in AWS Secrets Manager
- Production deployment at https://gitea.poll-streams.com
2026-06-08 19:51:24 +02:00

70 lines
2.0 KiB
Plaintext

# HTTP - redirect all traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name gitea.poll-streams.com;
# Let's Encrypt ACME challenge
location /.well-known/acme-challenge/ {
root /var/www/html;
}
# Redirect all other traffic to HTTPS
location / {
return 301 https://$server_name$request_uri;
}
}
# HTTPS
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name gitea.poll-streams.com;
# SSL certificates
ssl_certificate /etc/letsencrypt/live/gitea.poll-streams.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/gitea.poll-streams.com/privkey.pem;
# SSL configuration
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 10m;
# Security headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Logging
access_log /var/log/nginx/gitea-access.log;
error_log /var/log/nginx/gitea-error.log;
# Max upload size
client_max_body_size 512M;
# Proxy to Gitea
location / {
proxy_pass http://gitea:3000;
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_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Timeouts
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
}