
events {
    worker_connections 1024;
}

http {

    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;

    # (선택) 로그 위치
    access_log logs/access.log;
    error_log  logs/error.log warn;

    # 웹소켓용
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    server {
        listen 80;
        server_name localhost;

        # Nuxt(개발서버 3000)
        location / {
            proxy_pass http://localhost:3000;
            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_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }

        # Spring Boot(8080) — /service 접두어 제거
        location /service/ {
            proxy_pass http://localhost:8080;  # 끝에 슬래시 넣으면 /service가 제거됨
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        # (선택) 업로드 크게 받을 때
        # client_max_body_size 50m;
    }
}