05-27-2016, 03:58 PM | #1 | ||
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
Calibre-server reverse proxy issues
Hello there
I am running owncloud on my Ubuntu server and I also want to run calibre. I only want to port-forward 443 (https) and so am trying to reverse proxy into calibre through 443. I have calibre-server running as a daemon on systemd. At the moment I can access calibre quite happily within my LAN when I use 192.168.1.37:8080; however when I go externally I can only access the calibre front page (albeit without css) and I get a 404 not found from cherrypi when I navigate around the pages. My /etc/apache2/sites-available/000-default.conf file is: Quote:
Quote:
Last edited by dom134; 05-27-2016 at 03:59 PM. Reason: redacting |
||
05-27-2016, 04:45 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
As per https://manual.calibre-ebook.com/server.html
If you are using ProxyPass, you should set up a dedicated VirtualHost and NOT tell calibre to use an --url-prefix Or use an --url-prefix and RewriteRule, to serve calibre in a subdirectory of the hosted website. You seem to be mixing the two together. |
05-27-2016, 04:47 PM | #3 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Also, for your systemd unit you can skip --pidfile and --daemonize, and use Type=simple
|
05-28-2016, 05:58 AM | #4 | |
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
Thank you eschwartz,
I have amended my calibre.service file, but I think I am being an ignoramus when it comes to the virtualhost bit. I have created an additional virtualhost as follows, but still to no avail. Quote:
|
|
05-28-2016, 11:38 PM | #5 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Again: if you have a dedicated VirtualHost (which you do ) then:
... --url-prefix means calibre-server expects all internal urls to appear in http://www.dom134.com/calibre, which is useful in the event that the same server is serving something else in another directory. Using it means you need to use a RewriteRule to redirect only those subdirectory urls to calibre-server on port 8080. Since you are using a VirtualHost, you don't need that and can use ProxyPass instead, to forward everything as-is. You can use an --url-prefix, but it is silly and unnecessary. An apache ServerName expects to see the servername, not an url. An url is a ServerName followed by an optional directory/filename... tl;dr Why does your ServerName have a "/calibre" at the end? Last edited by eschwartz; 05-28-2016 at 11:56 PM. |
05-29-2016, 12:46 PM | #6 |
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
So, I have removed the --url-prefix from the calibre-server, but I still do not understand the virtualhost part.
I would like to have https://www.dom134.com/owncloud go to my owncloud (which it does) and then have https://www.dom134.com/calibre be redirected to my calibre-server running on :8080. Thank you for your patience! |
05-29-2016, 02:13 PM | #7 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
VirtualHost and ProxyPass is if you want to use https://calibre.dom134.com
RewriteRule and --url-prefix is if you want to use https://www.dom134.com/calibre So:
Last edited by eschwartz; 05-29-2016 at 02:18 PM. |
05-29-2016, 02:42 PM | #8 |
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
Hello eschwartz
You must be pulling your hair out! Thank you, I'm currently getting a 503 Service Unavailable so I will check to see if my proxy modules are enabled. Will let you know how it goes. |
05-29-2016, 03:29 PM | #9 | ||
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
Having a few issues getting calibre to work now! I'll get back to you soonest.
Anyway Quote:
Quote:
Unfortunately I am unable to access http://localhost:8080/calibre and I still get a 503 when accessing through url. I will grow some and try and work it out! Thanks! |
||
05-29-2016, 04:49 PM | #10 | |
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
eschwartz, thank you for your perseverance and patience with me - it all works!
On my calibre-service I had to change the Type from simple back to forking and then it all works. Just for completeness, my calibre-service is: Quote:
Regards dom134 |
|
05-29-2016, 05:19 PM | #11 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Weird. This is my unit file (it is templated with a per-server configuration file) and it works fine:
Code:
[eschwartz@arch ~]$ cat ~/.config/systemd/user/calibre-server@.service [Unit] Description=Main calibre server After=network.target [Service] EnvironmentFile=/%h/.config/calibre/servers/%i.conf ExecStart=/usr/bin/calibre-server \ --port="${port}" \ --with-library "${path}" \ --restriction "${restriction}" \ --user "${user}" \ --pass "${pass}" [Install] WantedBy=default.target I cannot think why a forked and daemonized /usr/bin/calibre-server would be any more likely to start than one which represents the main process of the service. EDIT: Maybe you forgot to remove PIDFile= when you switched to Type=simple and systemd nuked the process out of confusion? ... Really, it doesn't make a difference whether your daemonize and fork it, or not. It works either way, but Type=simple doesn't make systemctl wait while the server forks before returning. Since systemd natively knows how to track it. Or something. Last edited by eschwartz; 05-29-2016 at 05:28 PM. |
05-30-2016, 03:19 PM | #12 | |
Member
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
|
Still cannot get it to work without using 'forking'
I notice with your: Quote:
Last edited by dom134; 05-30-2016 at 03:23 PM. |
|
05-30-2016, 04:39 PM | #13 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
--user is one of the arguments to `calibre-server` and refers to the webserver login username/pasword.
Systemd per-user services are better done with `systemctl --user`. Although you can also run the service as root and tell it to invoke the "Exec=" command as a specific "User=" You can use the above systemd service file I posted, with the command Code:
systemctl start --user calibre-server@LibraryName.service Code:
port="8080" path="/home/eschwartz/Calibre Libraries/LibraryName" restriction="optional Virtual Library restriction" user="some_username" pass="some_password" Last edited by eschwartz; 05-30-2016 at 04:44 PM. |
Tags |
apache, calibre-server, reverse proxy, systemd |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Aldiko + Calibre-Server + Reverse Proxy | dummkauf | Related Tools | 4 | 02-02-2016 02:55 PM |
Calibre 2 behind Windows Proxy Server | ictstbenedicts | Calibre | 1 | 10-10-2012 12:41 PM |
need help with reverse proxy server | novaris | Devices | 1 | 09-10-2012 12:22 PM |
Content server apache reverse proxy issue | bossanova808 | Calibre | 13 | 09-16-2011 09:38 AM |
Content Server with Apache Reverse Proxy | Caleb666 | Calibre | 1 | 08-29-2011 04:20 PM |