seblucas / cops

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
GNU General Public License v2.0
1.43k stars 229 forks source link

multiple database & nginx #421

Open joshp23 opened 5 years ago

joshp23 commented 5 years ago

I can't seem to get this working with multiple databases and NGINX. I can browse the databases, but downloads all fail. I followed directions according to the wiki. Am I missing something that isn't explicitly stated in the wiki?

joshp23 commented 5 years ago

I was able to get this working with the following setup:

config.local.php

Set the path to the 2 libraries explicitly as per instructions:

$config['calibre_directory'] = array ("Default" => "/home/USER/path/to/Calibre/epub/", "PDF" => "/home/USER/path/to/Calibre/pdf/");

In the same file, use the following to ensure the correct directory is set per database being browsed, making sure to order the databases correctly according to their appearance in the above array, starting with 0:

if (!empty ($_GET) && isset($_GET['db']) && $_GET['db'] != '') {
    if ( $_GET['db'] == 0 )
        $config['calibre_internal_directory'] = "/epub/";
    elseif ( $_GET['db'] == 1 )
        $config['calibre_internal_directory'] = "/pdf/";
}

nginx

Set directories for the above locations like so:

location "/epub" {
    root "/home/USER/path/to/Calibre/";
    internal;
}

location "/pdf" {
    root "/home/USER/path/to/Calibre/";
    internal;
}

If there is a better way to do this, this guy is all ears.

Chirishman commented 5 years ago

The if statement code block above provided what I needed to get downloads working for multiple databases in this COPS docker container.

Fotoratte commented 3 years ago

The if statement code block above provided what I needed to get downloads working for multiple databases in this COPS docker container.

I got it working, when i set internal directory to '' and mounted the libaries under /books