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

# Server Configuration

> Configure Jellyfin Server settings, options, and environment variables

Jellyfin Server provides extensive configuration options to customize your media server experience. Configuration can be managed through the web interface, configuration files, or environment variables.

## Configuration Files

Jellyfin stores its configuration in XML and JSON files within the data directory:

<CodeGroup>
  ```bash Linux theme={null}
  /var/lib/jellyfin/
  ├── config/
  │   ├── system.xml              # Server configuration
  │   ├── network.xml             # Network settings
  │   ├── encoding.xml            # Transcoding settings
  │   └── logging.json            # Logging configuration
  ├── data/                       # Database and metadata
  ├── cache/                      # Temporary cache files
  └── log/                        # Server logs
  ```

  ```bash Windows theme={null}
  C:\ProgramData\Jellyfin\Server\
  ├── config\
  │   ├── system.xml
  │   ├── network.xml
  │   ├── encoding.xml
  │   └── logging.json
  ├── data\
  ├── cache\
  └── log\
  ```

  ```bash macOS theme={null}
  /Users/<username>/.config/jellyfin/
  ├── config/
  │   ├── system.xml
  │   ├── network.xml
  │   ├── encoding.xml
  │   └── logging.json
  ├── data/
  ├── cache/
  └── log/
  ```
</CodeGroup>

## Core Server Settings

### Server Configuration (system.xml)

The main server configuration file contains essential settings:

<Steps>
  <Step title="Server Name and Culture">
    Configure the server's display name and localization settings:

    ```xml theme={null}
    <ServerName>My Jellyfin Server</ServerName>
    <UICulture>en-US</UICulture>
    <PreferredMetadataLanguage>en</PreferredMetadataLanguage>
    <MetadataCountryCode>US</MetadataCountryCode>
    ```
  </Step>

  <Step title="Metadata Path">
    Specify where Jellyfin stores metadata:

    ```xml theme={null}
    <MetadataPath>/var/lib/jellyfin/metadata</MetadataPath>
    ```

    <Info>If not specified, metadata is stored in the default internal metadata path within the data directory.</Info>
  </Step>

  <Step title="Library Settings">
    Configure library scanning and monitoring:

    ```xml theme={null}
    <LibraryMonitorDelay>60</LibraryMonitorDelay>
    <LibraryUpdateDuration>30</LibraryUpdateDuration>
    <LibraryScanFanoutConcurrency>0</LibraryScanFanoutConcurrency>
    <LibraryMetadataRefreshConcurrency>0</LibraryMetadataRefreshConcurrency>
    ```

    * `LibraryMonitorDelay`: Seconds to wait after file system change (default: 60)
    * `LibraryUpdateDuration`: Seconds to wait before executing library changed notification (default: 30)
    * Concurrency set to `0` uses automatic values based on CPU count
  </Step>

  <Step title="Playback Settings">
    Configure playback resume behavior:

    ```xml theme={null}
    <MinResumePct>5</MinResumePct>
    <MaxResumePct>90</MaxResumePct>
    <MinResumeDurationSeconds>300</MinResumeDurationSeconds>
    <MinAudiobookResume>5</MinAudiobookResume>
    <MaxAudiobookResume>5</MaxAudiobookResume>
    ```
  </Step>
</Steps>

### Cache Configuration

```xml theme={null}
<CacheSize>10000</CacheSize>
<ImageExtractionTimeoutMs>0</ImageExtractionTimeoutMs>
```

* `CacheSize`: Maximum number of items to cache (default: `ProcessorCount * 100`)
* `ImageExtractionTimeoutMs`: Timeout for image extraction (0 = no limit)

## Environment Variables

Jellyfin supports various environment variables for configuration:

<Tabs>
  <Tab title="Data Paths">
    Control where Jellyfin stores its data:

    ```bash theme={null}
    JELLYFIN_DATA_DIR=/path/to/data
    JELLYFIN_CONFIG_DIR=/path/to/config
    JELLYFIN_CACHE_DIR=/path/to/cache
    JELLYFIN_LOG_DIR=/path/to/logs
    ```
  </Tab>

  <Tab title="FFmpeg Configuration">
    Configure FFmpeg behavior:

    ```bash theme={null}
    # FFmpeg probe settings
    JELLYFIN_FFmpeg_probesize=1G
    JELLYFIN_FFmpeg_analyzeduration=200M

    # Skip FFmpeg validation (not recommended)
    JELLYFIN_FFmpeg_skipvalidation=false

    # Performance trade-off for image extraction
    JELLYFIN_FFmpeg_imgextract_perf_tradeoff=false
    ```

    <Warning>These settings are defined in `ConfigurationOptions.cs` and affect transcoding performance and accuracy.</Warning>
  </Tab>

  <Tab title="Web Client">
    Control web client hosting:

    ```bash theme={null}
    JELLYFIN_HostWebClient=true
    JELLYFIN_DefaultRedirect=web/
    ```
  </Tab>

  <Tab title="Database">
    SQLite cache configuration:

    ```bash theme={null}
    JELLYFIN_SqliteCacheSize=20000
    ```
  </Tab>

  <Tab title="Logging">
    Configure logging output:

    ```bash theme={null}
    JELLYFIN_LOG_DIR=/var/log/jellyfin
    ```
  </Tab>
</Tabs>

## Logging Configuration

Jellyfin uses Serilog for structured logging. Configuration is stored in `logging.json`:

```json theme={null}
{
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "outputTemplate": "[{Timestamp:HH:mm:ss.fff}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}"
        }
      },
      {
        "Name": "Async",
        "Args": {
          "configure": [
            {
              "Name": "File",
              "Args": {
                "path": "%JELLYFIN_LOG_DIR%//log_.log",
                "rollingInterval": "Day",
                "retainedFileCountLimit": 3,
                "rollOnFileSizeLimit": true,
                "fileSizeLimitBytes": 100000000,
                "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}"
              }
            }
          ]
        }
      }
    ],
    "Enrich": ["FromLogContext", "WithThreadId"]
  }
}
```

### Log Levels

<Tabs>
  <Tab title="Verbose">
    Most detailed logging for debugging:

    ```json theme={null}
    "Default": "Verbose"
    ```
  </Tab>

  <Tab title="Debug">
    Detailed information for troubleshooting:

    ```json theme={null}
    "Default": "Debug"
    ```
  </Tab>

  <Tab title="Information">
    Normal operational messages (default):

    ```json theme={null}
    "Default": "Information"
    ```
  </Tab>

  <Tab title="Warning">
    Warnings and non-critical issues:

    ```json theme={null}
    "Default": "Warning"
    ```
  </Tab>

  <Tab title="Error">
    Error messages only:

    ```json theme={null}
    "Default": "Error"
    ```
  </Tab>
</Tabs>

### Activity Log Retention

Configure how long activity logs are retained:

```xml theme={null}
<ActivityLogRetentionDays>30</ActivityLogRetentionDays>
```

<Tip>Set to null or omit to keep logs indefinitely.</Tip>

## Performance Tuning

### Session Management

```xml theme={null}
<InactiveSessionThreshold>0</InactiveSessionThreshold>
```

Set the threshold in minutes for closing inactive sessions. Set to `0` to disable.

### Slow Response Monitoring

```xml theme={null}
<EnableSlowResponseWarning>true</EnableSlowResponseWarning>
<SlowResponseThresholdMs>500</SlowResponseThresholdMs>
```

Log warnings for requests that take longer than the specified threshold.

## Security Settings

### Quick Connect

```xml theme={null}
<QuickConnectAvailable>true</QuickConnectAvailable>
```

Enable or disable Quick Connect for easy device pairing.

### Client Log Upload

```xml theme={null}
<AllowClientLogUpload>true</AllowClientLogUpload>
```

Allow clients to upload logs to the server for troubleshooting.

### Legacy Authorization

```xml theme={null}
<EnableLegacyAuthorization>false</EnableLegacyAuthorization>
```

<Warning>Only enable legacy authorization if required for compatibility with older clients.</Warning>

## CORS Configuration

Configure Cross-Origin Resource Sharing:

```xml theme={null}
<CorsHosts>
  <string>*</string>
</CorsHosts>
```

<Info>Default allows all origins. For production, specify allowed domains explicitly.</Info>

## Path Substitution

Map paths for different environments (e.g., Docker, network shares):

```xml theme={null}
<PathSubstitutions>
  <PathSubstitution>
    <From>/media/old-path</From>
    <To>/media/new-path</To>
  </PathSubstitution>
</PathSubstitutions>
```

## Best Practices

<Steps>
  <Step title="Backup Configuration">
    Regularly back up your configuration directory:

    ```bash theme={null}
    tar -czf jellyfin-config-backup.tar.gz /var/lib/jellyfin/config/
    ```
  </Step>

  <Step title="Use Environment Variables for Containers">
    When running in Docker, prefer environment variables over editing config files:

    ```yaml theme={null}
    environment:
      - JELLYFIN_DATA_DIR=/config
      - JELLYFIN_LOG_DIR=/config/log
    ```
  </Step>

  <Step title="Monitor Performance">
    Enable metrics for monitoring:

    ```xml theme={null}
    <EnableMetrics>true</EnableMetrics>
    ```
  </Step>

  <Step title="Keep Logs Manageable">
    Configure log retention and size limits to prevent disk space issues.
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Network Setup" icon="network-wired" href="./networking">
    Configure networking, ports, and remote access
  </Card>

  <Card title="Transcoding" icon="film" href="./transcoding">
    Set up media transcoding and codec options
  </Card>
</CardGroup>
