MenelAfter seeing<br><b>Improving snac Performance with Nginx Proxy Cache</b> from <span class="h-card"><a href="https://snac.it-notes.dragas.net/itnotes" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@itnotes@snac.it-notes.dragas.net</a></span> via<br> <a href="https://snac.it-notes.dragas.net/itnotes/p/1738139676.258050" rel="nofollow noopener noreferrer" target="_blank">https://snac.it-notes.dragas.net/itnotes/p/1738139676.258050</a><br><a href="https://it-notes.dragas.net/2025/01/29/improving-snac-performance-with-nginx-proxy-cache/" rel="nofollow noopener noreferrer" target="_blank">https://it-notes.dragas.net/2025/01/29/improving-snac-performance-with-nginx-proxy-cache/</a><br> I decided to prematurely optimize and adjust this for my apache2 httpd server in debian where I run snac.<br><br>I've never done any caching etc before so it was a nice adventure to learn something new. The documentation helped and in the end it wasn't very hard. I learned a bit about some http headers and regex on the way too.<br><br>Basically it works like this:<br>Enable the relevant modules:<br><br>´a2enmod expires cache cache_disk´<br><br>Be sure "htcacheclean" is running to clean up old disk cache. (under debian see /etc/default/apache-htcacheclean or else the relevant systemd service)<br>Then add to the snac virtualhost config:<br><pre> CacheRoot /var/cache/apache2/mod_cache_disk<br> CacheQuickHandler off<br> CacheLock on<br> <a href="https://snikket.de/social?t=optional" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Optional</a> while testing stuff;<br> CacheDetailHeader on<br> <br> <a href="https://snikket.de/social?t=my" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#My</a> Instance ist not at the root, but under "/social"; so this needs to be adapted:<br> <LocationMatch "^/social/[^/]+/s"><br> CacheEnable disk<br> ExpiresActive On<br> ExpiresDefault "access plus 30 days"<br> </LocationMatch><br></pre>This will use the disk cache to cache everything under the /s/ Path, same as the original ngnix tutorial, Utilizing the mod_expires to generate the appropriate cache headers (for lazy ones like me), In this case caching it for 30 days.<br>Further reading and all options explained under <a href="https://httpd.apache.org/docs/2.4/caching.html" rel="nofollow noopener noreferrer" target="_blank">https://httpd.apache.org/docs/2.4/caching.html</a> ff<br><br>Thanks for the initial tutorial <span class="h-card"><a href="https://snac.it-notes.dragas.net/itnotes" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@itnotes@snac.it-notes.dragas.net</a></span><br><br>Edit:<br>Oh and don't hesitate to tell me what I did stupid while setting this up, maybe in nicer words, if it is. And also I can't get the markdown Code formatting working apparently. well. Sorry for all the edits.<br><br><a href="https://snikket.de/social?t=fediverse" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Fediverse</a> <a href="https://snikket.de/social?t=hosting" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Hosting</a> <a href="https://snikket.de/social?t=itnotes" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#ITNotes</a> <a href="https://snikket.de/social?t=networking" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Networking</a> <a href="https://snikket.de/social?t=apache2" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#apache2</a> <a href="https://snikket.de/social?t=httpd" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#httpd</a> <a href="https://snikket.de/social?t=ownyourdata" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Ownyourdata</a> <a href="https://snikket.de/social?t=server" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Server</a> <a href="https://snikket.de/social?t=snac" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Snac</a> <a href="https://snikket.de/social?t=snac2" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Snac2</a> <a href="https://snikket.de/social?t=social" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Social</a> <a href="https://snikket.de/social?t=tipsandtricks" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Tipsandtricks</a> <a href="https://snikket.de/social?t=tutorial" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Tutorial</a> <a href="https://snikket.de/social?t=web" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Web</a> <a href="https://snikket.de/social?t=debian" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#Debian</a><br>