> ## Documentation Index
> Fetch the complete documentation index at: https://sonamu.cartanova.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 포트가 이미 사용 중

> 포트 충돌 해결하기

포트 충돌 문제와 해결 방법을 다룹니다.

## 개발 서버 포트 충돌

### 증상

```bash theme={null}
pnpm dev

Error: listen EADDRINUSE: address already in use :::10280
```

### 원인

지정된 포트에서 다른 프로세스가 이미 실행 중입니다.

### 해결 방법

#### 1. 프로세스 확인 및 종료

**macOS/Linux:**

```bash theme={null}
# 포트 사용 중인 프로세스 확인
lsof -i :10280

# 프로세스 종료
kill -9 <PID>
```

**Windows:**

```bash theme={null}
# 포트 사용 중인 프로세스 확인
netstat -ano | findstr :10280

# 프로세스 종료
taskkill /PID <프로세스ID> /F
```

#### 2. 포트 수동 지정

`sonamu.config.ts`:

```typescript theme={null}
export default {
  server: {
    listen: {
      port: 10281, // 다른 포트 사용
      host: "localhost",
    },
  },
} satisfies SonamuConfig;
```

## Sonamu UI 접근

### 설명

Sonamu UI는 API 서버와 같은 포트를 사용하며, `/sonamu-ui` 경로로 접근합니다.

```bash theme={null}
# API 서버 포트 변경
```

```typescript theme={null}
export default {
  server: {
    listen: {
      port: 10280,
    },
  },
} satisfies SonamuConfig;
```

Sonamu UI 접근: `http://localhost:10280/sonamu-ui`

## 여러 프로젝트 동시 실행

### 증상

여러 Sonamu 프로젝트를 동시에 실행하려는데 포트가 충돌합니다.

### 해결 방법

각 프로젝트마다 다른 포트 사용:

**프로젝트 A:**

```typescript theme={null}
// sonamu.config.ts
export default {
  server: {
    listen: {
      port: 10280,
    },
  },
} satisfies SonamuConfig;
```

**프로젝트 B:**

```typescript theme={null}
// sonamu.config.ts
export default {
  server: {
    listen: {
      port: 10380,
    },
  },
} satisfies SonamuConfig;
```

## PostgreSQL 포트 충돌

### 증상

```bash theme={null}
Error: could not connect to server: Connection refused
  Is the server running on host "localhost" (::1) and accepting
  TCP/IP connections on port 5432?
```

### 원인

PostgreSQL이 실행되지 않았거나, 다른 프로세스가 5432 포트를 사용 중입니다.

### 해결 방법

#### 1. PostgreSQL 실행 확인

```bash theme={null}
# macOS
brew services list
brew services start postgresql

# Linux
sudo systemctl status postgresql
sudo systemctl start postgresql
```

#### 2. 다른 포트로 PostgreSQL 실행

PostgreSQL 설정 파일(`postgresql.conf`)에서:

```conf theme={null}
port = 5433  # 다른 포트 사용
```

재시작 후 `.env` 파일 업데이트:

```bash theme={null}
DB_PORT=5433
```

#### 3. 포트 충돌 프로세스 확인

```bash theme={null}
lsof -i :5432
```

## 관련 문서

* [서버 설정](/ko/configuration/sonamu-config/server)
* [개발 환경 설정](/ko/getting-started/development-setup)
