Skip to main content

Overview

Bitwarden Server services are configured through appsettings.json files and environment variables. Each service has its own configuration file with service-specific settings and shared global settings.

Configuration Files

Each service has multiple configuration files that are loaded in order:
  1. appsettings.json - Base configuration
  2. appsettings.{Environment}.json - Environment-specific settings
  3. Environment variables - Override any setting
Settings are loaded in order with later sources overriding earlier ones. Environment variables have the highest precedence.

Global Settings

All services share a common globalSettings section:
appsettings.json

Core Settings

boolean
default:"false"
Set to true for self-hosted deployments. Disables cloud-specific features and telemetry.
string
default:"Bitwarden"
Display name shown in emails and UI.
string
required
Service name (Api, Identity, Admin, etc.). Auto-set in Docker images.

Database Configuration

string
required
SQL Server connection string. Supports SQL Server, PostgreSQL, and MySQL.Examples:
string
Optional read replica connection string for read-heavy operations.

Certificate Configuration

string
required
SHA-1 thumbprint of certificate used for signing tokens. The certificate must:
  • Be installed in the certificate store
  • Have a private key
  • Be valid (not expired)
Generate thumbprint:
string
required
Certificate for ASP.NET Core Data Protection. Can be the same as Identity Server certificate.

Storage Configuration

string
required
Blob storage connection string for attachments and sends.Azure Blob Storage:
Local Filesystem (Development only):
AWS S3 (requires additional configuration):
string
Separate storage for file attachments. Falls back to storage.connectionString.
string
Separate storage for Send files. Falls back to storage.connectionString.

Mail Configuration

Service URLs

object
required
Public URLs for all services. Required for CORS, redirects, and inter-service communication.All URLs must:
  • Use HTTPS in production
  • Be publicly accessible
  • Match your reverse proxy configuration

Message Bus Configuration

Service-Specific Configuration

API Service

appsettings.json
object
Rate limiting configuration to prevent abuse:
  • EnableEndpointRateLimiting - Enable rate limiting
  • RealIpHeader - Header containing client IP (behind proxy)
  • GeneralRules - Array of rate limit rules by endpoint
object
Limits for bulk vault imports:
  • ciphersLimit - Max items per import (default: 40000)
  • collectionRelationshipsLimit - Max collection relationships (default: 80000)
  • collectionsLimit - Max collections per import (default: 2000)

Identity Service

appsettings.json
Strict rate limiting on /connect/token is critical for preventing brute force attacks.

Notifications Service

appsettings.json

SSO Service

appsettings.json

Environment-Specific Configurations

Development

appsettings.Development.json

Production

appsettings.Production.json

Environment Variables

Override any configuration using environment variables with double underscore notation:
In Docker Compose:
See Environment Variables for complete reference.

Configuration Validation

Services validate configuration on startup. Common errors:
Solution: Ensure certificate is installed in correct store (My/Personal) and thumbprint is correct.
Solution:
  • Verify database exists
  • Check connection string credentials
  • Ensure SQL Server is accessible
  • Run database migrations
Solution: Check connection string format and escape special characters in passwords.

Security Best Practices

Secrets Management

  • Never commit secrets to version control
  • Use environment variables for sensitive data
  • Consider using Azure Key Vault or HashiCorp Vault
  • Rotate credentials regularly

Certificate Security

  • Use certificates from trusted CAs
  • Store private keys securely
  • Set appropriate permissions on certificate stores
  • Monitor certificate expiration

Rate Limiting

  • Enable rate limiting on all public endpoints
  • Adjust limits based on usage patterns
  • Monitor for unusual traffic
  • Whitelist trusted IPs if needed

Logging

  • Set appropriate log levels
  • Never log sensitive data (passwords, tokens)
  • Configure log retention
  • Use structured logging

Configuration Templates

Official configuration templates are available in the source repository:

Next Steps

Environment Variables

Complete environment variable reference

Database Setup

Configure and initialize the database

SSL Certificates

Set up SSL/TLS certificates

Operations

Monitor and maintain your deployment