Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...) http://blog.slucas.fr/en/oss/calibre-opds-php-server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.8KB

  1. DirectoryIndex index.php
  2. <IfModule mod_xsendfile.c>
  3. <Files fetch.php>
  4. XSendFile on
  5. </Files>
  6. </IfModule>
  7. ###########################################
  8. # If the notation above don't work, you can try that one
  9. # Disclaimer : I'm no apache expert it can be bad security wise :(
  10. ###########################################
  11. #XSendFile On
  12. #XSendFileAllowAbove on
  13. ###########################################
  14. # On WAMP one user had to add this line in his httpd.conf
  15. # None of the above was working
  16. ###########################################
  17. #XSendFilePath <YourCalibrePath>
  18. ###########################################
  19. # If you want to use user based configuration with
  20. # apache 2.4 + php-fpm enable this
  21. # https://github.com/seblucas/cops/issues/213
  22. ###########################################
  23. #SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
  24. <IfModule mod_rewrite.c>
  25. RewriteEngine on
  26. RewriteRule ^download/(\d*)/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&db=$2&type=epub [L]
  27. RewriteRule ^download/(\d*)/(\d*)/.*\.(.*)$ fetch.php?data=$1&db=$2&type=$3 [L]
  28. RewriteRule ^download/(\d*)/.*\.kepub\.epub$ fetch.php?data=$1&type=epub [L]
  29. RewriteRule ^download/(\d*)/.*\.(.*)$ fetch.php?data=$1&type=$2 [L]
  30. </IfModule>
  31. <IfModule mod_expires.c>
  32. ExpiresActive on
  33. # Data
  34. ExpiresByType text/xml "access plus 0 seconds"
  35. ExpiresByType application/xml "access plus 0 seconds"
  36. ExpiresByType application/json "access plus 0 seconds"
  37. ExpiresByType application/xhtml+xml "access plus 0 seconds"
  38. # Favicon (cannot be renamed)
  39. ExpiresByType image/x-icon "access plus 1 week"
  40. # Media: images
  41. ExpiresByType image/png "access plus 1 month"
  42. ExpiresByType image/jpg "access plus 1 month"
  43. ExpiresByType image/jpeg "access plus 1 month"
  44. # Webfonts
  45. ExpiresByType font/truetype "access plus 1 month"
  46. ExpiresByType font/opentype "access plus 1 month"
  47. ExpiresByType application/x-font-woff "access plus 1 month"
  48. ExpiresByType image/svg+xml "access plus 1 month"
  49. ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  50. # CSS and JavaScript
  51. ExpiresByType text/css "access plus 1 year"
  52. ExpiresByType application/javascript "access plus 1 year"
  53. ExpiresByType text/javascript "access plus 1 year"
  54. </IfModule>
  55. ###########################################
  56. # Uncomment if you wish to protect access with a password
  57. ###########################################
  58. # If your covers and books are not available as soon as you protect it
  59. # You can try replacing the FilesMatch directive by this one
  60. # <FilesMatch "(index|feed)\.php">
  61. # If helps for Sony PRS-TX and Aldiko, beware fetch.php can be accessed
  62. # with authentication (see $config ['cops_fetch_protect'] for a workaround).
  63. ###########################################
  64. #<FilesMatch "\.php$">
  65. #AuthUserFile /path/to/file
  66. #AuthGroupFile /dev/null
  67. #AuthName "Acces securise"
  68. #AuthType Basic
  69. #Require valid-user
  70. #</FilesMatch>