# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

worker_processes 1;
worker_rlimit_nofile 4096;
events {
    worker_connections 2048;
    multi_accept on;
    use epoll;
}
http {
    upstream backend_servers {
        least_conn;
        # Select all the upstream vLLM servers to load balance across, including those at a different node if applicable.
        server 127.0.0.1:8001 max_fails=3 fail_timeout=10000s;
        server 127.0.0.1:8002 max_fails=3 fail_timeout=10000s;
    }
    server {
        listen 8000;
        location / {
            proxy_pass http://backend_servers;
            proxy_http_version 1.1;
            proxy_read_timeout 240s;
        }
    }
}
