Seafile on Apache2 server running on Raspberry Pi

1,021 views
Skip to first unread message

cfro...@gmail.com

unread,
May 25, 2014, 4:23:05 PM5/25/14
to sea...@googlegroups.com

I have worked through the installation instructions for Seafile 2.1.5 for Raspberry Pi - based on the instructions on github.

 

I am using Apache2 as the web server - as that is already installed & (was) operational.  PHP5 is also installed and the Seahub FastCGI has been downloaded, compiled & installed too.

 

I am using MySQL as the underlying database - and followed the instructions on the github site to create the instance - the necessary tables (ccnet_db, seafile-db, seahub-db) are in place and I can see suitable entries in them.

 

I started Seafile & Seahub (fastcgi) successfully - although I still have to do this on every reboot

 

I have also installed the Windows and iPad clients - both run and allow me to sync / access files.

 

My remaining problems are with the web client - via Apache.  Ever since following the seafile apache instructions - I have been unable to get the (originally working) basic web browser test to run (from looking at the files - the seahub service is installed on port 80 - so I think that has 'stolen' the standard port).

 

I do have some unix admin experience - but nothing on MySQL or Apache - so have been following instructions in published projects without actually understanding all the implications

 

The problems are .. in priority order .. and I would really appreciate some pointers on how to resolve these:

 

1) - When I access the seafile system via the web browser, I don't get any of the icons, css or layout ... just a very messy raw display.  I checked the FAQ on the seafile wiki - and think I have followed the instructions to alias /media and set the file ownership - but it made no difference. ... this is probably the most urgent issue.

 

2) - Apache cant find the servername on startup.   The 'ServerName' directive is used in the /etc/apache2/servers-enabled/000-default file & maps to an external servername on 'noip.org'.

 

3) - The standard Seafile install seems to grab port 80.  I was planning to host a separate web server on that.  How do I get a (working) Seafile installation to use a different HTTP port ... is it as 'simple' as modifying the virtual server entry in a copy of that file?

 

4) - I had hoped that getting these (originally windows based) files onto a unix server would mean that I could run some scripts to automatically make backups, produce indexes, etc ... but the way that seafile organises the uploaded data seems to prevent that.  Is there any diagnostic / indexing or other admin tools with Seafile?

 

-----

 

The files:

 

These are slightly modified versions of the system files being used - with the ip / dns addresses & name / passwords altered  The following files are all owned by user 'seafile:seafile' and have permission 755:

 

~seafile/mycloud/ccnet/ccnet.conf

[General]
USER_NAME = *USER_NAME*
ID =*ID*
NAME = *USER_NAME*
SERVICE_URL =
http://mydns.noip.org

[Network]
PORT = *An open port on my router*

[Client]
PORT = 13418

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = *a user account defined for MySQL*
PASSWD = *The password for the above account*
DB = ccnet-db
CONNECTION_CHARSET = utf8

 

~seafile/mycloud/seafile_settings.py

SECRET_KEY = "*a secret key*"
HTTP_SERVER_ROOT = 'http://mydns.noip.org/seafhttp'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': '*same user as identified in ccnet.conf*',
        'PASSWORD': '*same password as identified in ccnet.conf',
        'HOST': '127.0.0.1',
        'PORT': '3306',
        'OPTIONS': {
            'init_command': 'SET storage_engine=INNODB',
        }
    }
}

I think that the above is correct as seafile / hub both start and I am able to use the dedicated clients

 

The following apache2 config files are all owned by root:root and have permission 644

/etc/apache2/apache2.conf

 

I added the following to the bottom of this file:


# FastCGI addition for Seafile
FastCGIExternalServer /var/www/seahub.fcgi -host 127.0.0.1:8000

/etc/apache2/sites-enabled

 

the 000-default file here has permission 777 and is a link to '...sites-available/default'

 

/etc/sites-available/default

<VirtualHost *:80>
ServerAdmin
*The seafile admin account*
ServerName mydns.noip.org
        DocumentRoot /var/www
#        Alias /media /home/seafile/mycloud/seafile-server-latest/seahub/media  --- note this was the path provided by the install script - the following line is the edited path to allow me to set permission & ownership to www-data
        Alias /media /var/www/media

        RewriteEngine On

        <Location /media>
        Require all granted
        </Location>
#
# seafile httpserver
#
        ProxyPass /seafhttp
http://127.0.0.1:8082
        ProxyPassReverse /seafhttp http://127.0.0.1:8082
        RewriteRule ^/seafhttp - [QSA,L]

#
# seahub
#
        RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ /seahub.fcgi$1 [QSA,L,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

in /var/www I have fastcgi and media folders - both owned by www-data:www-data & with permission 755.  The content of /home/seafile/mycould/seafile-server-latest/media was copied to the /var/www/media folder to try to resolve this issue (after looking at the seafile wiki)

 

I get errors in the apache2 error.log file ..

 

[Sun May 25 13:18:32 2014] [notice] FastCGI: process manager initialized (pid 3615)
[Sun May 25 13:18:32 2014] [notice] Apache/2.2.22 (Debian) mod_fastcgi/mod_fastcgi-SNAP-0910052141 PHP/5.4.4-14+deb7u9 configured -- resuming normal operations
[Sun May 25 13:18:56 2014] [error] [client 192.168.1.13] (111)Connection refused: FastCGI: failed to connect to server "/var/www/seahub.fcgi": connect() failed
[Sun May 25 13:18:56 2014] [error] [client 192.168.1.13] FastCGI: incomplete headers (0 bytes) received from server "/var/www/seahub.fcgi"
[Sun May 25 13:19:11 2014] [error] [client 192.168.1.13] (111)Connection refused: FastCGI: failed to connect to server "/var/www/seahub.fcgi": connect() failed
[Sun May 25 13:19:11 2014] [error] [client 192.168.1.13] FastCGI: incomplete headers (0 bytes) received from server "/var/www/seahub.fcgi"
[Sun May 25 13:25:50 2014] [error] (111)Connection refused: proxy: HTTP: attempt to connect to 127.0.0.1:8082 (127.0.0.1) failed
[Sun May 25 13:25:50 2014] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Sun May 25 13:25:50 2014] [error] [client 192.168.1.13] (111)Connection refused: FastCGI: failed to connect to server "/var/www/seahub.fcgi": connect() failed
[Sun May 25 13:25:50 2014] [error] [client 192.168.1.13] FastCGI: incomplete headers (0 bytes) received from server "/var/www/seahub.fcgi"
[Sun May 25 13:29:32 2014] [crit] [client 192.168.1.13] configuration error:  couldn't perform authentication. AuthType not set!: /media/js/base.js, referer:
http://192.168.1.12/accounts/login/
[Sun May 25 13:29:32 2014] [crit] [client 192.168.1.13] configuration error:  couldn't perform authentication. AuthType not set!: /media/css/ui-lightness/jquery-ui-1.8.16.custom.css, referer: http://192.168.1.12/accounts/login/  ... it goes on to complain about lots of other files at this point.....

 

Let me know if anything else is needed to diagnose ...

 

Thanks

 

Michele Innocenti

unread,
May 28, 2014, 5:22:20 AM5/28/14
to sea...@googlegroups.com
I'm trying to install seafile with fastcgi on a debian server and I'm experiencing the same problem that you described in point 1.
I do not have the problem of point 2 then 1 does not depend on that.
From what I understand the problem might be this:

http://fuelphp.com/forums/discussion/12825/rest-authentication-does-not-work-under-default-cgi-configurations-solution-within

I'm not sure, however, because in sites-enabled/000-default:

   #
   # seahub
   #
   RewriteRule ^ / (media. *) $ / $ 1 [QSA, L, PT]
   RewriteCond% {REQUEST_FILENAME}!-F
   RewriteRule ^ (. *) $ / Seahub.fcgi $ 1 [QSA, L, E = HTTP_AUTHORIZATION:% {HTTP: Authorization}]

In any case, for now I could not solve the problem.
Perhaps the guide lacks some detail in the case of installation on a debian server.

Michele Innocenti

unread,
May 29, 2014, 1:29:38 PM5/29/14
to sea...@googlegroups.com

For issue number 1.
Check the version of apache2 in use:
apt-cache show apache2

If you have version 2.2.x, edit the file /etc/sites-available/default
Change

   <Location /media>
    Require all Granted
   </ Location>

in

   <Location /media>
     Order allow, deny
     Allow from all
     # Require all Granted
   </ Location>

Restart apache

http://httpd.apache.org/docs/2.4/upgrading.html

Reply all
Reply to author
Forward
0 new messages