Skip to content

Instantly share code, notes, and snippets.

@alexcastrodev
Created October 1, 2025 17:09
Show Gist options
  • Select an option

  • Save alexcastrodev/e2d8748447617dd7ec40f4b7d4abbc8d to your computer and use it in GitHub Desktop.

Select an option

Save alexcastrodev/e2d8748447617dd7ec40f4b7d4abbc8d to your computer and use it in GitHub Desktop.
upstream registry_backend {
zone registry_web 64k;
server registry_registry:5000 resolve;
keepalive 32;
}
# Servidor HTTP (porta 80) -> redireciona para HTTPS
server {
listen 80;
server_name registry.aa-planning.dev;
return 301 https://$host$request_uri;
}
# Servidor HTTPS (porta 443)
server {
listen 443 ssl;
server_name registry.aa-planning.dev;
client_max_body_size 0;
proxy_read_timeout 3600;
proxy_send_timeout 3600;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Evite reescritas automáticas
proxy_redirect off;
location / {
proxy_pass http://registry_backend;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# **Sem map, sem $scheme** — fixe como https
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Authorization $http_authorization;
add_header Docker-Distribution-Api-Version registry/2.0 always;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment