Skip to content

Instantly share code, notes, and snippets.

@Steffo99
Last active July 9, 2023 17:13
Show Gist options
  • Save Steffo99/ed6da2b0b2e4d05b0614687494298f21 to your computer and use it in GitHub Desktop.
Save Steffo99/ed6da2b0b2e4d05b0614687494298f21 to your computer and use it in GitHub Desktop.
**VERY OLD AND UNMAINTAINED** · Apache configuration file for Lemmy content aggregator
<VirtualHost *:443 >
# Your server name
ServerName example.org
ServerAdmin [email protected]
# Use HTTPS
SSLEngine on
# Enable reverse proxy mode
ProxyRequests On
ProxyTimeout 600
# Proxy pictshare
<Location "/pictshare">
ProxyPass http://127.0.0.1:8537/
ProxyPassReverse http://127.0.0.1:8537/
</Location>
# Proxy iframely
<Location "/iframely">
ProxyPass http://127.0.0.1:8061/
ProxyPassReverse http://127.0.0.1:8061/
</Location>
# Proxy Lemmy
<Location "/">
ProxyPass http://127.0.0.1:8536/
ProxyPassReverse http://127.0.0.1:8536/
</Location>
# Correctly proxy websocket traffic
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:8536/$1 [P,L]
# Let's Encrypt cert
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.org/privkey.pem
</VirtualHost>
@bjoern-tantau
Copy link

You should add ProxyPreserveHost On. Otherwise you run into LemmyNet/lemmy#3273

@Steffo99
Copy link
Author

Steffo99 commented Jul 8, 2023

Wait, people are using this super old config?

Does it still work? 😮

@bjoern-tantau
Copy link

Well, we don't need the pictshare and iframely bit (and it wouldn't work anyways, it would have to be after the Lemmy Proxy). And I don't know about the SSL stuff, I have something else doing that for me.

But all in all it works, apart from the bug I mentioned.

It's the first result on Google when trying to find out how to proxy Lemmy on Apache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment