Deployment Architecture
Two common patterns:Pattern 1: Reverse Proxy Mode
nginx forwards all traffic to Anubis, which validates and forwards to the backend:Pattern 2: External Auth Mode
nginx uses Anubis as an authentication service:Reverse Proxy Configuration
Upstream Definition
Define Anubis as an upstream in/etc/nginx/conf.d/upstream-anubis.conf:
Server Configuration
Create a reusable include file/etc/nginx/conf-anubis.inc:
Complete Example
Here’s a complete working configuration: docker-compose.ymlExternal Auth Configuration
For nginx’sauth_request module, configure Anubis without a target:
Anubis configuration:
Unix Socket Configuration
For maximum performance when nginx and Anubis are on the same server: Anubis:Multi-Site Configuration
You can protect multiple sites with one Anubis instance:*.example.com subdomains.
TLS Considerations
When nginx terminates TLS and forwards HTTP to Anubis, some applications (like WordPress) may not detect HTTPS correctly. Configure your application to trust theX-Forwarded-Proto header.
For WordPress, add to wp-config.php:
Testing
Verify headers are being forwarded correctly:Performance Tuning
Connection Keepalive
Buffering
Troubleshooting
Anubis sees nginx’s IP instead of client IP
Make sure you’re not using--use-remote-address when behind nginx. Anubis should read from X-Real-IP or X-Forwarded-For headers.
502 Bad Gateway
Check that:- Anubis is running and listening on the correct address
- nginx can reach Anubis (check network connectivity)
- If using Unix socket, verify permissions
Redirect loops
Ensure:REDIRECT_DOMAINSincludes your domain- Cookie domain is set correctly
- HTTPS is properly detected (check X-Forwarded-Proto)