Now that Mastodon is demanding https or else go fish (good sh!t), you'll also need a reverse proxy. To get EVERYTHING running swell, I had to scour the search engines and finally fell on this cool page
As-is, it didn't work since my own setup is different and my router does the whole redirection-to-multiple-different-hosts-and-or-ports thing, so here's how I did the part of the reverse proxy config itself. Note that I may have also used other pages as cross-inspiration; this is merely the end result that worked for me. YMMV etc.
<VirtualHost _default_:443>
DocumentRoot "/some/stuff"
ServerName your.own.mastodon.target.dns.name
ServerAdmin [email protected]
ErrorLog "/path/to/your/target_error_log"
TransferLog "/path/to/your/target_access_log"
SSLEngine on
Protocols h2 http/1.1
SSLCertificateFile "/path/to/your.acmed.domain.cer"
SSLCertificateKeyFile "/path/to/your.acmed.domain.key"
SSLCertificateChainFile "/path/to/fullchain.cer"
SSLCACertificateFile "/path/to/ca.cer"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Strict-Transport-Security "max-age=31536000"
<LocationMatch "^/(assets|avatars|emoji|headers|packs|sounds|system)">
Header always set Cache-Control "public, max-age=31536000, immutable"
Require all granted
</LocationMatch>
<Location "/">
Require all granted
</Location>
ProxyRequests Off
ProxyPreserveHost On
SSLProxyEngine On
AllowEncodedSlashes NoDecode
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ProxyAddHeaders On
ProxyPass /api/v1/streaming ws://<TARGET>:4000/
ProxyPassReverse /api/v1/streaming ws://<TARGET>:4000/
ProxyPass / http://<TARGET>:3000/
ProxyPassReverse / http://<TARGET>:3000/
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/share/apache2/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "LOGPATH" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
ErrorDocument 500 /500.html
ErrorDocument 501 /500.html
ErrorDocument 502 /500.html
ErrorDocument 503 /500.html
ErrorDocument 504 /500.html
</VirtualHost>