But for some reason the seafile server then redirects me from https:// seafile . mydomain . com to localhost/accounts/login?next=/
I can replace localhost in the address bar myself and open https:// seafile . mydomain . com/accounts/login?next=/ which then works just fine.
I log in on the page and it redirects me to localhost.
Again I can replace localhost and open https:// seafile . mydomain . com/ which works fine again.
When I edit my nginx configuration and replace localhost with 127.0.0.1 then I always get redirected to 127.0.0.1.
Any ideas how I could fix this? I’d really appreciate it!
Yes thats everything. The seafile container itself also comes with an nginx installation.
I am basically just getting my traffic on port 443 passed to the docker container listening on 3001 which then has its own ‘location /seafhttp’ and stuff configured.
The nginx config in the seafile docker container is generated based on this
I took a look inside my container and this is the nginx config in there:
You are missing some vital settings in the one you originally posted, Some of these settings that are both in the template and the container. Should be under proxy_pass http://localhost:3001; You are also missing the entire location /seafhttp section, which is necessary to sync files. I would use the settings in the template, excepting the https cert locations. Obviously, yours are stored elsewhere. The primary things you are missing are all of the proxy_set_header lines, and the entire seafhttp location.
And I’m still vague on exactly what it is you are trying to accomplish. So, your stripped down NGinx file, you are trying to sending to another NGinx installation?
I don’t know if that’s possible. There have been people who have tried allowing something else, say a router, to handle the http certs and then forward the traffic to NGinx/Apache. However, I’ve not known anyone to be successful with it.
On top of that, even if you were successful with that config, you are using a custom port, 3001, but you aren’t listening for that port inside the docker. You are listening for port 80.
Honestly, I’m not certain how to go about passing from one NGinx instance to another. Maybe someone else can shed some light on whether or not you can pull it off that way. Nor do I use dockers, so my experience is limited there as well.
What I do know is that in order for a web server to work, it has to know where to find the folders, and in the case of Seafile, that would be the root location and the seafhttp location.
I finally got it working! It was indeed the missing proxy_set_header lines.
I just copied the one from the template to my own nginx config and its working now.
The /seafhttp for example is not necessary as the docker container just exposes one port.
To clear things up about my setup:
I am running a VPS with nginx and docker installed. I am using docker to install all services I want to run, like Gitea on port 3001, Seafile on port 3002, Tiny tiny RSS on port 3003, and so on.
The nginx installation on my VPS then manages the incoming traffic and uses reverse proxies to make these service accessible via my domain and with my ssl certificates.
The seafile docker container comes with nginx already bundled. If I would be running just seafile on my VPS, I could just make the container expose port 443 and be fine with it, but then I couldn’t setup reverse proxies for my other containers. So I mapped the port 80, which the container exposes to port 3001 on my VPS.
docker run -d --name seafile -v /docker/seafile:/shared -p 127.0.0.1:3001:80 seafileltd/seafile:latest
In the end my nginx config looks like this and works perfectly so far!
I am in the exact same configuration as you, nginx reverse-proxy docker container used to redirect to other docker containers, one of them being seafile (seafile container itself embedding a nginx reverse-proxy server to its seahub and seafile servers, as previsouly explained).
im facing exactly the same problem right now … got it working using https, but then can’t download /upload . if someone able to solved this problem , care to share with us ?
i have only an issue with seafdav.
MOVE returns 502 Bad Gateway
for exp. on FolderSync App 502 Bad Gateway: Source and destination must have the same scheme. If you are running behind a reverse proxy, you may have to rewrite the 'Destination' header.
maybe same problem like:
EDIT:
in
seafile-data/nginx/conf/seafile.nginx.conf