6174c85c0f760cc7964b617825805582c2c8c095
[akkoma] / installation / pleroma-apache.conf
1 #Example configuration for when Apache httpd and Pleroma are on the same host.
2 #Needed modules: define headers proxy proxy_http proxy_wstunnel rewrite ssl
3 #This assumes a Debian style Apache config. Put this in /etc/apache2/sites-available
4 #Install your TLS certificate, possibly using Let's Encrypt.
5 #Replace 'pleroma.example.com' with your instance's domain wherever it appears
6
7 Define servername pleroma.example.com
8
9 ServerName ${servername}
10 ServerTokens Prod
11
12 ErrorLog ${APACHE_LOG_DIR}/error.log
13 CustomLog ${APACHE_LOG_DIR}/access.log combined
14
15 <VirtualHost *:80>
16 Redirect permanent / https://${servername}
17 </VirtualHost>
18
19 <VirtualHost *:443>
20 SSLEngine on
21 SSLCertificateFile /etc/letsencrypt/live/${servername}/cert.pem
22 SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem
23 SSLCertificateChainFile /etc/letsencrypt/live/${servername}/fullchain.pem
24
25 # Mozilla modern configuration, tweak to your needs
26 SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
27 SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
28 SSLHonorCipherOrder on
29 SSLCompression off
30 SSLSessionTickets off
31
32 Header always set X-Xss-Protection "1; mode=block"
33 Header always set X-Frame-Options "DENY"
34 Header always set X-Content-Type-Options "nosniff"
35 Header always set Referrer-Policy same-origin
36 Header always set Content-Security-Policy "default-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; connect-src 'self' wss://${servername}; upgrade-insecure-requests;"
37
38 # Uncomment this only after you get HTTPS working.
39 # Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
40
41 RewriteEngine On
42 RewriteCond %{HTTP:Connection} Upgrade [NC]
43 RewriteCond %{HTTP:Upgrade} websocket [NC]
44 RewriteRule /(.*) ws://localhost:4000/$1 [P,L]
45
46 ProxyRequests off
47 ProxyPass / http://localhost:4000/
48 ProxyPassReverse / http://localhost:4000/
49
50 RequestHeader set Host ${servername}
51 ProxyPreserveHost On
52 </VirtualHost>
53
54 # OCSP Stapling, only in httpd 2.3.3 and later
55 SSLUseStapling on
56 SSLStaplingResponderTimeout 5
57 SSLStaplingReturnResponderErrors off
58 SSLStaplingCache shmcb:/var/run/ocsp(128000)