update redirect location and use front controller

This commit is contained in:
mikespub 2026-02-10 14:33:56 +01:00
parent a2530f4cca
commit 31dc8357df
3 changed files with 23 additions and 11 deletions

View File

@ -57,7 +57,7 @@ param_ports:
# application setup block
app_setup_block_enabled: true
app_setup_block: |
Access the webui at `http://<docker host ip>:80`. For connecting via OPDS on a mobile device use `http://<docker host ip>:80/index.php/feed`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above).
Access the webui at `http://<docker host ip>:80`. For connecting via OPDS on a mobile device use `http://<docker host ip>:80/index.php/feed` or `http://<docker host ip>:80/feed`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above).
The linuxserver version gives you access to `config/local.php` in `/config` to customise your install to suit your needs, it also includes the dependencies required to directly view epub books in your browser.
# init diagram
@ -114,6 +114,7 @@ init_diagram: |
"cops:latest" <- Base Images
# changelog
changelogs:
- {date: "10.06.26:", desc: "Existing users should verify: site-confs/default.conf and config/local.php - Update redirect location and use front controller."}
- {date: "08.02.26:", desc: "Existing users should update: site-confs/default.conf - Deny access to all dotfiles."}
- {date: "08.02.26:", desc: "Adding missing php-tokenizer package."}
- {date: "10.10.25:", desc: "Adding missing icu-data-full package."}

View File

@ -35,6 +35,13 @@ $config['cops_title_default'] = "COPS";
*/
$config['cops_x_accel_redirect'] = "X-Accel-Redirect";
/*
* Map /books/ to internal redirect location for COPS 4.2+
*/
$config['cops_x_accel_mapping'] = [
'/books/' => '/_redirect_/',
];
/* Enable cache folder
* especially useful for lower power hosts
*/
@ -100,8 +107,6 @@ $config['cops_kepubify_path'] = '/usr/bin/kepubify';
* - Nginx: nginx.conf
* - PHP built-in: router.php
* - ...
*
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
*/
$config['cops_front_controller'] = '';
//$config['cops_front_controller'] = 'index.php';
//$config['cops_front_controller'] = '';
$config['cops_front_controller'] = 'index.php';

View File

@ -1,4 +1,4 @@
## Version 2026/02/08 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
## Version 2026/02/10 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
server {
listen 80 default_server;
@ -31,11 +31,6 @@ server {
expires 31d;
}
location /books {
root /;
internal;
}
location ~ ^(.+\.php)(.*)$ {
# enable the next two lines for http auth
#auth_basic "Restricted";
@ -48,6 +43,17 @@ server {
include /etc/nginx/fastcgi_params;
}
# use internal redirect location for X-Accel-Redirect - do not use /books/ or other COPS urls with front controller
location /_redirect_/ {
internal;
alias /books/;
}
# use front controller for COPS 4.2+
location ~ ^/(?!(index\.php|_redirect_)) {
try_files $uri /index.php$request_uri;
}
# deny access to all dotfiles
location ~ /\. {
deny all;