events {
    worker_connections 1024;
}

http {
    server {
        listen 80;
        server_name wanlanda.ru www.wanlanda.ru;
        
        location /.well-known/acme-challenge/ {
            root /var/www/certbot;
        }

        location / {
            return 301 https://$host$request_uri;
        }
    }

    server {
        listen 443 ssl;
        server_name wanlanda.ru www.wanlanda.ru;
        
        ssl_certificate /etc/letsencrypt/live/wanlanda.ru/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/wanlanda.ru/privkey.pem;
        
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

        location / {
            proxy_pass http://web:8000;
            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;
        }
    }
}

# events {
#     worker_connections 1024;
# }

# http {
#     server {
#         listen 80;
#         server_name localhost;

#         location / {
#             proxy_pass http://web:8000;
#             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;
#         }
#     }
# }