haiwen / seahub

The web end of seafile server.
seafile.com
Other
526 stars 368 forks source link

Problems using Seahub on non-root domain #300

Closed ns130291 closed 7 years ago

ns130291 commented 9 years ago

I have some problems using seahub 3.1.5 with a non-root domain.

If I set the SITE_ROOT = '/seafile/' and then go to mydomain.com/seafile the error message Sorry, but the requested page could not be found. appears. If I then manually add another /seafile at the end of the URL it tries to redirect to mydomain.com/seafile/accounts/login which also fails, as there is also missing the additional /seafile. So by changing the URL to mydomain.com/seafile/seafile/accounts/login it finally loads the login page. After logging in it redirects again to the wrong URL without the addtional /seafile. Adding again the /seafile fixes it again and you finally get to mydomain.com/seafile/seafile/home/my/. On that page most of the links are right, but there are some exceptions: the seafile logo, My Home and Help. On the admin page most links are wrong.

Is this behaviour fixed in a later version?

shoeper commented 9 years ago

have you done all this? http://manual.seafile.com/deploy/deploy_Seahub_at_Non-root_domain.html

ns130291 commented 9 years ago

Yes, I did: in seahub_settings.py

FILE_SERVER_ROOT = 'https://www.mydomain.com/seafhttp'

SERVER_STATIC = False
MEDIA_URL = '/seafmedia/'
SITE_ROOT = '/seafile/'

in ccnet.conf

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

and my configuration of lighttpd

# Seafile config
fastcgi.server += ( "/seafile" => ((
            "host" => "127.0.0.1",
            "port" => "8000",
            "check-local" => "disable",
            "allow-x-send-file" => "enable"
          )))

# lighttpd as reverse proxy
$HTTP["url"] =~ "(^/seafhttp)" {
    proxy.server = ( "" => (
        "" => (
            "host" => "127.0.0.1",
                "port" => 81
              )
        )
    )
}

$SERVER["socket"] == ":81" {
    url.rewrite-once = ( "^/seafhttp(.*)$" => "$1" )
    proxy.server = ( "" => (
                "" => (
                        "host" => "127.0.0.1",
                        "port" => 8082
                      )
                )
        )
}

alias.url += (
    "/seafmedia" => "/opt/goflex/seafile-server-latest/seahub/media"
)
rdsqc22 commented 9 years ago

This seems to work fine for me.

Initially I had a problem just like the one you described, but then I saw this issue, and saw your seahub_settings .py. Mine has only contained this:

FILE_SERVER_ROOT = 'https://www.mydomain.com/seafile'

I modified to contain:

FILE_SERVER_ROOT = 'https://www.mydomain.com/seafile'

SERVER_STATIC = False
MEDIA_URL = '/media/'
SITE_ROOT = '/seafile/'

And now it works as expected.