2022-07-06 12:50:01 -06:00
|
|
|
# Sample Apache config for Akkoma
|
2018-11-03 16:59:52 -06:00
|
|
|
#
|
|
|
|
# Simple installation instructions:
|
2021-01-21 11:25:18 -07:00
|
|
|
# 1. Install your TLS certificate. We recommend using Let's Encrypt via Certbot
|
|
|
|
# 2. Replace 'example.tld' with your instance's domain.
|
|
|
|
# 3. This assumes a Debian-style Apache config. Copy this file to
|
|
|
|
# /etc/apache2/sites-available/ and then activate the site by running
|
2022-07-06 12:50:01 -06:00
|
|
|
# 'a2ensite akkoma-apache.conf', then restart Apache.
|
2019-02-22 12:18:03 -07:00
|
|
|
#
|
|
|
|
# Optional: enable disk-based caching for the media proxy
|
2022-07-15 06:27:16 -06:00
|
|
|
# For details, see https://docs.akkoma.dev/stable/configuration/howto_mediaproxy/
|
2019-02-22 12:18:03 -07:00
|
|
|
#
|
2021-01-21 11:25:18 -07:00
|
|
|
# 1. Create a directory as shown below for the CacheRoot and make sure
|
2019-02-22 12:18:03 -07:00
|
|
|
# the Apache user can write to it.
|
|
|
|
# 2. Configure Apache's htcacheclean to clean the directory periodically.
|
2021-01-21 11:25:18 -07:00
|
|
|
# Your OS may provide a service you can enable to do this automatically.
|
2018-08-28 17:29:04 -06:00
|
|
|
|
2018-11-04 06:06:18 -07:00
|
|
|
Define servername example.tld
|
2018-11-03 16:41:37 -06:00
|
|
|
|
2021-01-21 11:25:18 -07:00
|
|
|
<IfModule !proxy_module>
|
|
|
|
LoadModule proxy_module libexec/apache24/mod_proxy.so
|
|
|
|
</IfModule>
|
|
|
|
<IfModule !proxy_http_module>
|
|
|
|
LoadModule proxy_http_module libexec/apache24/mod_proxy_http.so
|
|
|
|
</IfModule>
|
|
|
|
<IfModule !proxy_wstunnel_module>
|
|
|
|
LoadModule proxy_wstunnel_module libexec/apache24/mod_proxy_wstunnel.so
|
|
|
|
</IfModule>
|
|
|
|
<IfModule !rewrite_module>
|
|
|
|
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
|
|
|
|
</IfModule>
|
|
|
|
<IfModule !ssl_module>
|
|
|
|
LoadModule ssl_module libexec/apache24/mod_ssl.so
|
|
|
|
</IfModule>
|
|
|
|
<IfModule !cache_module>
|
|
|
|
LoadModule cache_module libexec/apache24/mod_cache.so
|
|
|
|
</IfModule>
|
|
|
|
<IfModule !cache_disk_module>
|
|
|
|
LoadModule cache_disk_module libexec/apache24/mod_cache_disk.so
|
|
|
|
</IfModule>
|
|
|
|
|
2018-11-03 16:41:37 -06:00
|
|
|
ServerName ${servername}
|
2018-08-28 17:29:04 -06:00
|
|
|
ServerTokens Prod
|
|
|
|
|
2022-07-06 12:50:01 -06:00
|
|
|
# If you want Akkoma-specific logs
|
|
|
|
#ErrorLog /var/log/httpd-akkoma-error.log
|
|
|
|
#CustomLog /var/log/httpd-akkoma-access.log combined
|
2018-08-28 17:29:04 -06:00
|
|
|
|
2018-04-08 13:22:24 -06:00
|
|
|
<VirtualHost *:80>
|
2021-01-21 11:25:18 -07:00
|
|
|
RewriteEngine on
|
|
|
|
RewriteCond %{SERVER_NAME} =${servername}
|
|
|
|
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
|
2018-08-28 17:29:04 -06:00
|
|
|
</VirtualHost>
|
|
|
|
|
|
|
|
<VirtualHost *:443>
|
|
|
|
SSLEngine on
|
2020-05-06 07:20:47 -06:00
|
|
|
SSLCertificateFile /etc/letsencrypt/live/${servername}/fullchain.pem
|
2018-11-03 16:41:37 -06:00
|
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem
|
2021-01-21 11:25:18 -07:00
|
|
|
# Make sure you have the certbot-apache module installed
|
|
|
|
Include /etc/letsencrypt/options-ssl-apache.conf
|
2018-08-28 17:29:04 -06:00
|
|
|
|
2021-01-21 11:25:18 -07:00
|
|
|
# Uncomment the following to enable MediaProxy caching on disk
|
2024-05-15 14:58:58 -06:00
|
|
|
#CacheRoot /var/tmp/akkoma-media-cache/
|
2021-01-21 11:25:18 -07:00
|
|
|
#CacheDirLevels 1
|
|
|
|
#CacheDirLength 2
|
|
|
|
#CacheEnable disk /proxy
|
|
|
|
#CacheLock on
|
|
|
|
#CacheHeader on
|
|
|
|
#CacheDetailHeader on
|
|
|
|
## 16MB max filesize for caching, configure as desired
|
|
|
|
#CacheMaxFileSize 16000000
|
|
|
|
#CacheDefaultExpire 86400
|
2019-02-22 12:18:03 -07:00
|
|
|
|
2018-04-10 02:08:27 -06:00
|
|
|
RewriteEngine On
|
|
|
|
RewriteCond %{HTTP:Connection} Upgrade [NC]
|
|
|
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
2021-01-21 11:25:18 -07:00
|
|
|
RewriteRule /(.*) ws://127.0.0.1:4000/$1 [P,L]
|
2018-08-28 17:29:04 -06:00
|
|
|
|
2021-01-21 11:25:18 -07:00
|
|
|
#ProxyRequests must be off or you open your server to abuse as an open proxy
|
2018-04-10 02:08:27 -06:00
|
|
|
ProxyRequests off
|
2019-05-23 15:33:27 -06:00
|
|
|
ProxyPass / http://127.0.0.1:4000/
|
|
|
|
ProxyPassReverse / http://127.0.0.1:4000/
|
2018-04-10 02:08:27 -06:00
|
|
|
ProxyPreserveHost On
|
2018-04-08 13:22:24 -06:00
|
|
|
</VirtualHost>
|