Seafile behind Caddy Web Server

Anybody managed to run seafile behind Caddy in a subfolder?

I have followed any guide a could find but to no good.

Maybe somebody would be kind enough to share his caddyfile and seafile settings of a similar setup :slight_smile:

Edit : no takers? Comon, somebody out there must have a similar setup. Show some fellowship and spare me the agony :blush:

I’ve never heard of Caddy, just checked now.

You are welcome to post your config so we might be able to solve it together.

Nginx doesn’t work for you?

You cannot run Seafile in a “Subfolder”. You can use an existing webserver on your machine as reverse proxy though.

Thanks for the answer :smiley: and sorry for the delay, i was out of town for a week.

So i am thinking i need to take this from the start since i am kind of lost in trial and error.

First things first, in order to have seafile correctly setup for the reverse proxy to work i found two guides.

This: https://manual.seafile.com/deploy_windows/deploy_with_nginx.html says i need to:

ccnet.conf:

SERVICE_URL = http://www.mydomain.com

seafile.conf:

[seahub]
port=8000
fastcgi=true

seahub_settings.py:

FILE_SERVER_ROOT = ‘http://www.mydomain.com/seafhttp

And this: https://manual.seafile.com/deploy/deploy_seahub_at_non-root_domain.html says i need to:

ccnet.conf:

SERVICE_URL = http://www.mydomain.com/seafile

seahub_settings.py:

SERVE_STATIC = False
MEDIA_URL = ‘/seafmedia/’
COMPRESS_URL = MEDIA_URL
STATIC_URL = MEDIA_URL + ‘assets/’
SITE_ROOT = ‘/seafile/’
LOGIN_URL = ‘/seafile/accounts/login/’ # NOTE: since version 5.0.4
FILE_SERVER_ROOT = ‘http://www.myseafile.com/seafhttp

So i am assuming the correct Seafile setup in this scenario is a mix of the above like this:

seafile.conf:

[seahub]
port=8000
fastcgi=true

ccnet.conf:

SERVICE_URL = https://www.mydomain.com/seafile

seahub_settings.py:

SERVE_STATIC = False
MEDIA_URL = ‘/seafmedia/’
COMPRESS_URL = MEDIA_URL
STATIC_URL = MEDIA_URL + ‘assets/’
SITE_ROOT = ‘/seafile/’
LOGIN_URL = ‘/seafile/accounts/login/’ # NOTE: since version 5.0.4
FILE_SERVER_ROOT = ‘https://www.mydomain.com/seafhttp

Does the above seem correct?
Is fastcgi necessary in this scenario or it can be done in another way to simplify things?

Trying to simplify things i tried the following:

CADDY CONFIG:

https://www.mydomain.com http://www.mydomain.com {
tls xxx.crt xxx.key
gzip
log C:/Caddy/logs/www.mydomain.txt
proxy /sickrage localhost:8081 {
transparent
}
proxy /plexpy localhost:8181 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Proto {scheme}
header_upstream X-Forwarded-Host {host}
header_upstream X-Forwarded-Ssl {on}
}
proxy / 127.0.0.1:32400 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Proto {scheme}
header_upstream X-Forwarded-Host {host}
header_upstream X-Forwarded-Ssl {on}
}
proxy /deluge 127.0.0.1:8112 {
transparent
without /deluge
header_upstream X-Deluge-Base “/deluge”
}
proxy /seafile localhost:8000 {
transparent
}
}
https://www.mydomain.com/seafhttp http://www.mydomain.com/seafhttp {
tls cert.crt cert.key
gzip
log C:/Caddy/logs/www.mydomainseafhttp.txt
proxy / localhost:8082 {
transparent
}
}

AND

ccnet.conf
SERVICE_URL = https://www.mydomain.com/seafile

GIVES

AND LOGS

[25/May/2017:13:33:33 +0300] “GET /media/css/seahub.min.css?t=1482456805 HTTP/2.0” 401 82
46.198.xxxxx - - [25/May/2017:13:33:33 +0300] “GET /media/assets/css/bootstrap.min.b00faad199b5.css HTTP/2.0” 401 82
46.198.xxxx- - [25/May/2017:13:33:33 +0300] “GET /media/img/seafile-logo.png HTTP/2.0” 401 82
46.198.xxx - [25/May/2017:13:33:33 +0300] “GET /media/js/jquery-1.12.1.min.js HTTP/2.0” 401 82
46.198.xxx- - [25/May/2017:13:33:33 +0300] “GET /media/js/base.js?t=1482456805 HTTP/2.0” 401 82
46.198.xxx - - [25/May/2017:13:33:33 +0300] “GET /media/js/jq.min.js HTTP/2.0” 401 82
46.198.xxx - - [25/May/2017:13:33:33 +0300] “GET /media/assets/scripts/lib/jquery.simplemodal.67fb20a63282.js HTTP/2.0” 401 82
46.198.xxx- - [25/May/2017:13:33:33 +0300] “GET /media/assets/scripts/lib/jquery.ui.tabs.7406a3c5d2e3.js HTTP/2.0” 401 82
46.198.xxx - - [25/May/2017:13:33:33 +0300] “GET /media/js/jq.min.js HTTP/2.0” 401 82
46.198.xxx - - [25/May/2017:13:33:33 +0300] “GET /media/js/base.js?t=1482456805 HTTP/2.0” 401 82
46.198.xxx- - [25/May/2017:13:33:33 +0300] “GET /media/img/favicon.png?t=1482456805 HTTP/2.0” 401 82

Just a quick thought - did you consider using a subdomain, like seafile.mydomain.com instead of a subfolder? I am not sure where your issues originate from and whether a subdomain would therefore be a solution, but it might be worth a try.

Yeah subdomain whould probably work easier but i have a purchased dv certificate i am using that wont cover the subdomains.

Well after @DerDanilo suggesstion i managed to setup this and the rest of my services with nginx so all is good BUT the shared link returns a 404 Nginx error. Despite that everything else seems to be working inlcuding mobile clients, seahub uploads etc.

Share link looks like this
https://www.mydomain.com/f/53493e3a52/

Tried
https://www.mydomain.com/seafile/f/53493e3a52/
and it works!!!

So

this is the seafile blocks

location /seafile {
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
}
location /seafhttp {
rewrite ^/seafhttp(.)$ $1 break;
proxy_pass http://127.0.0.1:8082;
client_max_body_size 0;
}
location /seafmedia {
rewrite ^/seafmedia(.
)$ /media$1 break;
root C:\Seafile\seafile-server-6.0.7\seahub;
}

only thing different from the guide https://manual.seafile.com/deploy/deploy_seahub_at_non-root_domain.html is the

proxy_set_header X-Forwarded-For $remote_addr;

line.
Could this be the problem? If so should i add it inside one or maybe all of the above blocks?

OK so solved this, I haven’t noticed that webui settings take priority over . Conf. I had to update the service URL from webui to www.mydomain.com/seafile.

Thanks for this great product seafile team :slight_smile:

1 Like