Update instructions
[akkoma] / installation / pleroma-apache.conf
1 # default Apache site config for Pleroma
2 #
3 # needed modules: define headers proxy proxy_http proxy_wstunnel rewrite ssl
4 #
5 # Simple installation instructions:
6 # 1. Install your TLS certificate, possibly using Let's Encrypt.
7 # 2. Replace 'pleroma.example.tld' with your instance's domain wherever it appears.
8 # 3. This assumes a Debian style Apache config. Copy this file to
9 # /etc/apache2/sites-available/ and then add a symlink to it in
10 # /etc/apache2/sites-enabled/ by running 'a2ensite pleroma-apache.conf', then restart Apache.
11
12 Define servername pleroma.example.tld
13
14 ServerName ${servername}
15 ServerTokens Prod
16
17 ErrorLog ${APACHE_LOG_DIR}/error.log
18 CustomLog ${APACHE_LOG_DIR}/access.log combined
19
20 <VirtualHost *:80>
21 Redirect permanent / https://${servername}
22 </VirtualHost>
23
24 <VirtualHost *:443>
25 SSLEngine on
26 SSLCertificateFile /etc/letsencrypt/live/${servername}/cert.pem
27 SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem
28 SSLCertificateChainFile /etc/letsencrypt/live/${servername}/fullchain.pem
29
30 # Mozilla modern configuration, tweak to your needs
31 SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
32 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
33 SSLHonorCipherOrder on
34 SSLCompression off
35 SSLSessionTickets off
36
37 Header always set X-Xss-Protection "1; mode=block"
38 Header always set X-Frame-Options "DENY"
39 Header always set X-Content-Type-Options "nosniff"
40 Header always set Referrer-Policy same-origin
41 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;"
42
43 # Uncomment this only after you get HTTPS working.
44 # Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
45
46 RewriteEngine On
47 RewriteCond %{HTTP:Connection} Upgrade [NC]
48 RewriteCond %{HTTP:Upgrade} websocket [NC]
49 RewriteRule /(.*) ws://localhost:4000/$1 [P,L]
50
51 ProxyRequests off
52 ProxyPass / http://localhost:4000/
53 ProxyPassReverse / http://localhost:4000/
54
55 RequestHeader set Host ${servername}
56 ProxyPreserveHost On
57 </VirtualHost>
58
59 # OCSP Stapling, only in httpd 2.3.3 and later
60 SSLUseStapling on
61 SSLStaplingResponderTimeout 5
62 SSLStaplingReturnResponderErrors off
63 SSLStaplingCache shmcb:/var/run/ocsp(128000)