Created
March 29, 2025 17:18
-
-
Save hopeseekr/f044136e791513be061f0c8b27d329cc to your computer and use it in GitHub Desktop.
Optimized Calibre-web Apache reverse proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prequiste: For security, set Calibre to listen to 127.0.0.4:8083: | |
# Edit `/etc/systemd/system/multi-user.target.wants/calibre-web.service`: | |
# Change to `ExecStart=/usr/lib/calibre-web/cps.py -i 127.0.0.4` | |
# sudo systemctl daemon-reload | |
# sudo systemctl restart calibre-web | |
<VirtualHost *:443> | |
ServerName read.your.site | |
# SSL Configuration | |
SSLEngine on | |
SSLCertificateFile /etc/letsencrypt/live/read.your.site/fullchain.pem | |
SSLCertificateKeyFile /etc/letsencrypt/live/read.your.site/privkey.pem | |
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 | |
SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384 | |
SSLHonorCipherOrder on | |
# Logging | |
ErrorLog /var/log/apache2/read.your.site.error.log | |
CustomLog /var/log/apache2/read.your.site.log combined | |
# Common proxy settings | |
ProxyPreserveHost On | |
ProxyRequests Off | |
RequestHeader set X-Forwarded-Proto "https" | |
RequestHeader set X-Forwarded-Port "443" | |
TimeOut 300 | |
# Main proxy configuration | |
ProxyPass / http://127.0.0.4:8083/ | |
ProxyPassReverse / http://127.0.0.4:8083/ | |
# Special configuration for upload endpoints | |
<LocationMatch "/(upload|book/add|upload-new)"> | |
# Increased body size limit specifically for book uploads | |
LimitRequestBody 209715200 | |
# SECURITY NOTE: Same security considerations as in Nginx config | |
ProxyPass http://127.0.0.4:8083/ | |
ProxyPassReverse http://127.0.0.4:8083/ | |
</LocationMatch> | |
# WebSocket support | |
RewriteEngine On | |
RewriteCond %{HTTP:Upgrade} websocket [NC] | |
RewriteCond %{HTTP:Connection} upgrade [NC] | |
RewriteRule /(.*) ws://127.0.0.4:8083/$1 [P,L] | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.