Overview
Bitwarden Server services are configured throughappsettings.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:appsettings.json- Base configurationappsettings.{Environment}.json- Environment-specific settings- 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 commonglobalSettings section:
appsettings.json
Core Settings
Set to
true for self-hosted deployments. Disables cloud-specific features and telemetry.Display name shown in emails and UI.
Service name (Api, Identity, Admin, etc.). Auto-set in Docker images.
Database Configuration
SQL Server connection string. Supports SQL Server, PostgreSQL, and MySQL.Examples:
Optional read replica connection string for read-heavy operations.
Certificate Configuration
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)
Certificate for ASP.NET Core Data Protection. Can be the same as Identity Server certificate.
Storage Configuration
Blob storage connection string for attachments and sends.Azure Blob Storage:Local Filesystem (Development only):AWS S3 (requires additional configuration):
Separate storage for file attachments. Falls back to
storage.connectionString.Separate storage for Send files. Falls back to
storage.connectionString.Mail Configuration
SendGrid (Recommended)
SendGrid (Recommended)
SMTP
SMTP
Amazon SES
Amazon SES
Service URLs
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
- Azure Service Bus
- RabbitMQ
Service-Specific Configuration
API Service
appsettings.json
Rate limiting configuration to prevent abuse:
EnableEndpointRateLimiting- Enable rate limitingRealIpHeader- Header containing client IP (behind proxy)GeneralRules- Array of rate limit rules by endpoint
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
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:Configuration Validation
Services validate configuration on startup. Common errors:Certificate not found
Certificate not found
Database connection failed
Database connection failed
- Verify database exists
- Check connection string credentials
- Ensure SQL Server is accessible
- Run database migrations
Invalid connection string
Invalid connection string
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