1 # Sample Apache config for Pleroma
3 # Simple installation instructions:
4 # 1. Install your TLS certificate. We recommend using Let's Encrypt via Certbot
5 # 2. Replace 'example.tld' with your instance's domain.
6 # 3. This assumes a Debian-style Apache config. Copy this file to
7 # /etc/apache2/sites-available/ and then activate the site by running
8 # 'a2ensite pleroma-apache.conf', then restart Apache.
10 # Optional: enable disk-based caching for the media proxy
11 # For details, see https://git.pleroma.social/pleroma/pleroma/wikis/How%20to%20activate%20mediaproxy
13 # 1. Create a directory as shown below for the CacheRoot and make sure
14 # the Apache user can write to it.
15 # 2. Configure Apache's htcacheclean to clean the directory periodically.
16 # Your OS may provide a service you can enable to do this automatically.
18 Define servername example.tld
20 <IfModule !proxy_module>
21 LoadModule proxy_module libexec/apache24/mod_proxy.so
23 <IfModule !proxy_http_module>
24 LoadModule proxy_http_module libexec/apache24/mod_proxy_http.so
26 <IfModule !proxy_wstunnel_module>
27 LoadModule proxy_wstunnel_module libexec/apache24/mod_proxy_wstunnel.so
29 <IfModule !rewrite_module>
30 LoadModule rewrite_module libexec/apache24/mod_rewrite.so
32 <IfModule !ssl_module>
33 LoadModule ssl_module libexec/apache24/mod_ssl.so
35 <IfModule !cache_module>
36 LoadModule cache_module libexec/apache24/mod_cache.so
38 <IfModule !cache_disk_module>
39 LoadModule cache_disk_module libexec/apache24/mod_cache_disk.so
42 ServerName ${servername}
45 # If you want Pleroma-specific logs
46 #ErrorLog /var/log/httpd-pleroma-error.log
47 #CustomLog /var/log/httpd-pleroma-access.log combined
51 RewriteCond %{SERVER_NAME} =${servername}
52 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
57 SSLCertificateFile /etc/letsencrypt/live/${servername}/fullchain.pem
58 SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem
59 # Make sure you have the certbot-apache module installed
60 Include /etc/letsencrypt/options-ssl-apache.conf
62 # Uncomment the following to enable MediaProxy caching on disk
63 #CacheRoot /tmp/pleroma-media-cache/
66 #CacheEnable disk /proxy
70 ## 16MB max filesize for caching, configure as desired
71 #CacheMaxFileSize 16000000
72 #CacheDefaultExpire 86400
75 RewriteCond %{HTTP:Connection} Upgrade [NC]
76 RewriteCond %{HTTP:Upgrade} websocket [NC]
77 RewriteRule /(.*) ws://127.0.0.1:4000/$1 [P,L]
79 #ProxyRequests must be off or you open your server to abuse as an open proxy
81 ProxyPass / http://127.0.0.1:4000/
82 ProxyPassReverse / http://127.0.0.1:4000/