# HTTP → HTTPS редирект
server {
    listen 80;
    server_name ebook.miduway.space;
    return 301 https://$host$request_uri;
}

# HTTPS
server {
    listen 443 ssl;
    server_name ebook.miduway.space;

    # SSL (Certbot)
    ssl_certificate /etc/letsencrypt/live/ebook.miduway.space/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/ebook.miduway.space/privkey.pem;

    location / {
        proxy_pass http://frontend:3000;  # Имя сервиса из docker-compose
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
} 