How to Self-Host Friendica with Docker Compose
A Facebook-Shaped Hole in the Fediverse
Most fediverse platforms replicate Twitter’s short-post format. Friendica takes a different path — it’s built around long-form posts, photo albums, events, groups, and the kind of multi-format social experience Facebook provides. It federates via ActivityPub (Mastodon, Pleroma, Misskey), Diaspora, and OStatus simultaneously, making it one of the most protocol-versatile platforms in the decentralized social web. Official site
Friendica started as “Mistpark” in 2010, making it one of the oldest actively maintained fediverse projects. It’s PHP-based, runs on Apache or Nginx, and uses MariaDB/MySQL for storage. The Docker deployment simplifies what would otherwise be a manual LAMP stack setup.
| Feature | Details |
|---|---|
| Protocol Support | ActivityPub, Diaspora, OStatus |
| License | AGPL-3.0 |
| Language | PHP |
| Latest Stable | 2026.01 (“Blutwurz”) |
| Web UI | Built-in (multiple themes) |
| Mobile App | Fedilab, Friendica-compatible clients |
| Federation | Full (Mastodon, Pleroma, Misskey, Diaspora, Hubzilla) |
Prerequisites
- A Linux server (Ubuntu 22.04+ recommended)
- Docker and Docker Compose installed (guide)
- 1 GB RAM minimum (2 GB recommended)
- 10 GB of free disk space
- A domain name with DNS configured
- SMTP credentials for sending email notifications (optional but recommended)
| Requirement | Minimum | Recommended |
|---|---|---|
| RAM | 1 GB | 2 GB |
| CPU | 1 core | 2 cores |
| Disk | 5 GB | 20 GB+ |
| Network | Domain with HTTPS | Domain + reverse proxy |
Docker Compose Configuration
Create a project directory:
mkdir -p /opt/friendica && cd /opt/friendica
Create a db.env file with your database credentials:
MYSQL_USER=friendica
MYSQL_PASSWORD=change-this-strong-password
MYSQL_DATABASE=friendica
Create a docker-compose.yml file:
services:
db:
image: mariadb:11.4
restart: unless-stopped
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
env_file:
- db.env
networks:
- friendica-net
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 30s
timeout: 10s
retries: 5
redis:
image: redis:7.4-alpine
restart: unless-stopped
volumes:
- redis-data:/data
networks:
- friendica-net
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 5s
retries: 3
app:
image: friendica:2026.01-apache
restart: unless-stopped
volumes:
- friendica-data:/var/www/html
environment:
FRIENDICA_ADMIN_MAIL: [email protected] # Admin account email
FRIENDICA_TZ: UTC # Server timezone
FRIENDICA_LANG: en # Default language
FRIENDICA_URL: https://social.yourdomain.com # Full URL with protocol
FRIENDICA_SITENAME: My Friendica # Instance name
MYSQL_HOST: db # Database service name
REDIS_HOST: redis # Redis service name
env_file:
- db.env
ports:
- "8080:80"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- friendica-net
cron:
image: friendica:2026.01-apache
restart: unless-stopped
volumes:
- friendica-data:/var/www/html
entrypoint: /cron.sh
environment:
MYSQL_HOST: db
REDIS_HOST: redis
env_file:
- db.env
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- friendica-net
volumes:
db-data:
redis-data:
friendica-data:
networks:
friendica-net:
Start the stack:
docker compose up -d
The first startup takes 1-2 minutes while Friendica initializes the database schema and downloads dependencies.
Initial Setup
- Open
http://your-server-ip:8080in your browser - Friendica auto-configures using the environment variables you set — the database connection, admin email, and site URL are pre-populated
- Register your admin account using the email address you specified in
FRIENDICA_ADMIN_MAIL - Log in and navigate to Admin → Site to verify your instance settings
The admin account is the first account registered that matches the FRIENDICA_ADMIN_MAIL address. Other accounts registered with different emails get regular user privileges.
Configuration
Essential Settings
In Admin → Site, configure:
- Registration policy: Open, approval-required, or closed
- Max image size: Default is 800KB — increase for photo-heavy usage
- Allowed HTML tags: Controls what formatting users can use in posts
- Directory URL: Set to
https://dir.friendi.cafor global discovery
Addon Management
Navigate to Admin → Addons to enable:
- LDAP/AD authentication: For SSO integration
- Diaspora connector: Federate with Diaspora pods
- OStatus connector: Legacy federation protocol
- Two-factor authentication: TOTP-based 2FA for user accounts
- CalDAV/CardDAV: Calendar and contact sync
Email Integration
For notifications and password resets, add SMTP settings to your docker-compose.yml app service:
environment:
SMTP: smtp.yourdomain.com
SMTP_PORT: 587
SMTP_AUTH_USER: your-smtp-user
SMTP_AUTH_PASS: your-smtp-password
SMTP_AUTH_METHOD: PLAIN
Advanced Configuration
PHP Tuning
Mount a custom php.ini for large instances:
volumes:
- ./custom-php.ini:/usr/local/etc/php/conf.d/custom.ini:ro
Create custom-php.ini:
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 512M
max_execution_time = 300
Federation Relay
To improve content discovery, connect to a relay:
- Go to Admin → Site → Relay server
- Enter a relay URL (e.g.,
https://relay.intahnet.co.uk) - Select the tags you want to follow
This pulls public posts from across the fediverse into your instance’s public timeline, making it feel active even with few local users.
Reverse Proxy
Friendica requires HTTPS for federation. Use a reverse proxy in front of port 8080.
Nginx Proxy Manager
Set up a proxy host:
- Domain:
social.yourdomain.com - Forward hostname:
localhost(or your server IP) - Forward port:
8080 - SSL: Request a new certificate with Let’s Encrypt
For manual Nginx config, see our Reverse Proxy Setup guide.
Caddy
social.yourdomain.com {
reverse_proxy localhost:8080
}
Backup
What to Back Up
| Data | Location | Priority |
|---|---|---|
| Database | db-data volume | Critical |
| Uploaded files | friendica-data volume (/var/www/html/) | Critical |
| Environment files | db.env, docker-compose.yml | Important |
| Redis cache | redis-data volume | Low (rebuilds automatically) |
Backup Commands
# Database dump
docker compose exec db mariadb-dump -u friendica -p friendica > friendica-backup-$(date +%Y%m%d).sql
# Volume backup
docker run --rm -v friendica-data:/data -v $(pwd):/backup alpine \
tar czf /backup/friendica-files-$(date +%Y%m%d).tar.gz -C /data .
For automated backup strategies, see our Backup Strategy guide.
Troubleshooting
Cron Not Running (Federation Stalls)
Symptom: Posts from other instances stop appearing. Outgoing posts aren’t delivered.
Fix: Verify the cron container is running:
docker compose logs cron
The cron container runs Friendica’s worker process every few minutes. If it’s restarting in a loop, check that db.env is readable and database credentials match.
Admin Account Not Created
Symptom: You registered but don’t have admin privileges.
Fix: The admin account must use the exact email specified in FRIENDICA_ADMIN_MAIL. If you used a different email, update the environment variable, restart the app container, and register a new account with the correct email.
docker compose down && docker compose up -d
Federation Not Working
Symptom: Can’t follow accounts on other instances. Remote profiles show errors.
Fix: Verify:
FRIENDICA_URLmatches your actual domain (includinghttps://)- HTTPS is properly configured through your reverse proxy
- Port 443 is reachable from the internet
- The cron container is running (federation happens in background jobs)
High Memory Usage
Symptom: The app container uses excessive RAM after running for days.
Fix: Friendica’s PHP processes can accumulate memory. Schedule a weekly container restart:
# Add to host crontab
0 4 * * 0 cd /opt/friendica && docker compose restart app cron
Images Not Loading
Symptom: Uploaded images return 404 or broken image icons.
Fix: Check volume permissions. The friendica-data volume must be writable by the web server user (www-data, UID 33):
docker compose exec app chown -R www-data:www-data /var/www/html/
Resource Requirements
| Metric | Idle | Under Load |
|---|---|---|
| RAM | ~250 MB | ~600 MB |
| CPU | Low | Medium (during federation) |
| Disk | 500 MB (app) | Grows with media uploads |
| Database | ~100 MB initial | Grows with posts/contacts |
With Redis, federation processing is noticeably faster and memory usage stays more stable. The cron container adds minimal overhead (~50 MB).
Verdict
If you want a fediverse presence that goes beyond microblogging, Friendica is the right tool. It handles long-form posts, events, photo albums, and group discussions in a way that Mastodon, Pleroma, and GoToSocial simply don’t attempt. The multi-protocol federation (ActivityPub + Diaspora + OStatus) means you can interact with more of the decentralized web than any other single platform.
The trade-off is resource usage and complexity — four containers (app, db, redis, cron) vs GoToSocial’s single binary. And the UI shows its age compared to Mastodon or Misskey. But for replacing Facebook-style social networking with something you control, Friendica is the only serious self-hosted option.
FAQ
Can I migrate from Mastodon to Friendica?
You can redirect followers using ActivityPub account migration, but post history doesn’t transfer. Friendica supports the standard Move activity, so followers on Mastodon instances will automatically re-follow your new Friendica account.
Does Friendica support groups?
Yes. Friendica has built-in forum/group functionality. Create a “forum” account type, and any post mentioning that account becomes a group discussion visible to all followers. This is a feature most other fediverse platforms lack.
How many users can one instance handle?
A 2 GB RAM server can comfortably handle 50-100 active users. Beyond that, tune PHP-FPM worker counts and consider the FPM variant with a dedicated Nginx container for better concurrency.
Is there a mobile app?
There’s no dedicated Friendica mobile app, but Fedilab (Android) has native Friendica support. The web UI is also responsive and works on mobile browsers.
Can I use Friendica with SSO?
Yes, via the LDAP addon. It supports LDAP, Active Directory, and can integrate with identity providers like Authentik or Authelia through LDAP backend.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments