Configure the Nexus server with comprehensive settings for network, security, authentication, and performance optimization. This section is organized by importance to help you quickly set up and secure your Nexus instance.
- Core Settings - Basic server settings, TLS, and health checks
- OAuth2 Authentication - Secure your instance with JWT validation and token forwarding
- Rate Limiting - Protect against abuse with configurable limits
- Client Identification - Enable user tracking and tiered access control
- CORS Configuration - Support browser-based clients
- CSRF Protection - Prevent cross-site request forgery attacks
Here's a complete example showing common server configurations:
# Basic server settings
[server]
listen_address = "0.0.0.0:8000"
[server.health]
enabled = true
path = "/health"
# TLS for production
[server.tls]
certificate = "/etc/nexus/server.crt"
key = "/etc/nexus/server.key"
# OAuth2 authentication
[server.oauth]
url = "https://auth.example.com/.well-known/jwks.json"
expected_issuer = "https://auth.example.com"
expected_audience = "nexus-api"
# Rate limiting
[server.rate_limits]
enabled = true
storage = "memory"
[server.rate_limits.per_ip]
limit = 100
interval = "60s"
# CORS for browser clients
[server.cors]
allow_origins = ["https://app.example.com"]
allow_methods = ["GET", "POST", "OPTIONS"]
allow_headers = ["authorization", "content-type"]
allow_credentials = true
Nexus looks for configuration in the following order:
- Path specified by
--config
flag nexus.toml
in current directory~/.nexus/config.toml
/etc/nexus/config.toml
All configuration values support environment variable substitution:
[server.oauth]
url = "{{ env.OAUTH_JWKS_URL }}"
expected_issuer = "{{ env.OAUTH_ISSUER }}"
- Start with core settings and add features as needed
- Always enable OAuth2 in production environments
- Use TLS certificates for secure connections
- Configure rate limiting before going live
- Test CORS settings with actual browser clients
- Monitor logs for security events and errors
For debugging, run Nexus with increased verbosity:
nexus --log debug
Check specific configuration sections for detailed troubleshooting guides.