Ctrl K
ComunidadGuías…

nginx.prod.conf

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
worker_processes auto;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    sendfile on;
    server_tokens off;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 4096;

    log_format main '[$time_local] "$request_method $server_protocol" '
                    '$status $body_bytes_sent request_id=$request_id';
    access_log /dev/stdout main;
    error_log /dev/stderr crit;

    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }

    resolver 127.0.0.11 ipv6=off valid=10s;
    map $host $remind_app {
        default http://app:5000;
    }

    server {
        listen 80;
        server_name chat.synvexai.com www.chat.synvexai.com;

        location = /health {
            proxy_pass $remind_app/health;
            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;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Request-Id $request_id;
        }

        location = /.well-known/http-opportunistic {
            return 404;
        }

        location ~* \.(?:php|phtml|phar)(?:/|$) {
            return 404;
        }

        location / {
            return 301 https://chat.synvexai.com$request_uri;
        }
    }

    server {
        listen 443 ssl;
        http2 on;
        server_name chat.synvexai.com www.chat.synvexai.com;

        ssl_certificate /etc/nginx/ssl/origin.crt;
        ssl_certificate_key /etc/nginx/ssl/origin.key;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_session_timeout 1d;
        ssl_session_cache shared:SSL:10m;
        ssl_prefer_server_ciphers off;

        client_max_body_size 10m;

        location = /.well-known/http-opportunistic {
            return 404;
        }

        location ~* \.(?:php|phtml|phar)(?:/|$) {
            return 404;
        }

        location / {
            proxy_pass $remind_app;
            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;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Port 443;
            proxy_set_header X-Request-Id $request_id;

            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;

            proxy_read_timeout 3600s;
            proxy_send_timeout 3600s;
            proxy_buffering off;
            proxy_request_buffering off;
        }
    }
}