set_real_ip_from 172.17.0.1;
set_real_ip_from 172.18.0.1;  # Si tienes una segunda red
real_ip_header X-Forwarded-For;
real_ip_recursive on;

server {
    listen 80;

    root /var/www/html;
    index index.php index.html;

    # Aumentar el tamaño máximo de archivo
    client_max_body_size 20M;
    send_timeout 300s;
    client_body_timeout 300s;
    proxy_read_timeout 300s;
    proxy_connect_timeout 300s;
    
    # Manejo de archivos PHP
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        # Configuración para FastCGI
        fastcgi_read_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_connect_timeout 300s;
    }

    location ~ ^/(status|ping)$ {
        fastcgi_pass php:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /\.ht {
        deny all;
    }
}
