Trouble Running Seahub behind Apache

I’m interested in running Seafile behind Apache, but not so that Seahub is served out of the root domain - I.E. instead of going to https://example.com, I’d like to go to https://example.com/seafile to access Seahub.

I thought it might be as simple as changing the ProxyPass directive in the Apache instructions, but that does’t seem to work. When I try to access Seahub, I receive an error message: Sorry, but the requested page could not be found.

And in seahub_django_request.log, I see:
[WARNING] django.request:170 get_response Not Found: /seafile//

Clearly, I’m not doing something right. What can I do to correct this?

Did you also change the seafile root url in the seafile configuration file?

I believe I’ve made all necessary config changes.

My ccnet.conf has SERVICE_URL = https://mydomain.com/seafile

My seahub_settings.py has SITE_ROOT = '/seafile' and FILE_SERVER_ROOT=https://mydomain.com/seafhttp.

You should paste the part of your apache config for seafile server.

Here is my working config.
apache 2.4 with ssl enabled, seafile pro server 6.0.2:

ccnet.conf
[General]
USER_NAME = seafile
SERVICE_URL = https://www.example.com/seafile

seafile.conf
[fileserver]
port = 8082

seahub_settings.py
SERVE_STATIC = False
MEDIA_URL = ‘/seafile/media/’
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.example.com/seafilehttp

apache.conf

Alias /seafile/media  /home/seafile/seafile-server-latest/seahub/media
RewriteEngine On

<Location /seafile/media>
    ProxyPass !
    Require all granted
</Location>

# seafile fileserver
#
ProxyPass /seafilehttp http://127.0.0.1:8082
ProxyPassReverse /seafilehttp http://127.0.0.1:8082
RewriteRule ^/seafilehttp - [QSA,L]

ProxyPass /seafhttp http://127.0.0.1:8082
ProxyPassReverse /seafhttp http://127.0.0.1:8082
RewriteRule ^/seafhttp - [QSA,L]
#
# seahub
#


RewriteRule ^/seafile$ /seafile/ [L,R=301]
SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
ProxyPass /seafile fcgi://127.0.0.1:8000/seafile
1 Like

What i have forgotten: seahub must be stated as fastcgi, like:

sudo -u seafile ./seahub.sh start-fastcgi

@markusweb That did it! Thank you so much for posting your example. I’m finally free of ownCloud! :slight_smile: