ISPConfig and Seafile – an updated guide

Updated on Feb 8, 2017:
added tips to install Seafile Pro and to set up a Startup Cron Job

DISCLAIMER: I am not an engineer nor a professional sysadmin. Use this guide at your own risk. You may loose data, fingers and other parts of your body, and your brain may be eaten by zombies. If something bad happens, do not complain with me.

Seafile is a great piece of free software: it allows you to have a dropbox-like service hosted on your own server, which means that your data are under your control (we know that Dropbox has already been hacked once in 2012, and we cannot be sure that it has not been hacked again since then…)

ISPConfig is a great piece of free software, too: even if it is designed as a tool for ISPs who sell web hosting services, it is useful also if you want to run your own server and you want an easy and powerful tool to manage websites, email accounts, mailing lists, etc. as well as to manage the server itself.

There is an old guide on to install and configure Seafile on ISPConfig, but it has not been updated and it does not work with most recent versions of Seafile.

So, here is my guide to install Seafile Server v6 on a server running Debian 8 (Jessie) and ISPConfig with Apache (it should work also on ISPConfig 3.1, but I did not tested it yet).

1) Upgrade Apache

As reported also in the Seafile manual, there are problems with filenames containing spaces if you use old Apache versions (< 2.4.12) with Seafile.
Since Debian Jessie still uses Apache v.2.4.10, we need to find a clean way to upgrade it: I chose to use the version provided by the Debian testing (stretch) repository.

Login as root, then:

apt update
apt upgrade
nano /etc/apt/sources.list.d/stretch.list

Put the following line:

deb stretch main

Save and exit, then:

nano /etc/apt/preferences.d/stretch

Put the following text

Package: apache2
Pin: release n=stretch
Pin-Priority: 990

Package: apache2-bin
Pin: release n=stretch
Pin-Priority: 990

Package: apache2-data
Pin: release n=stretch
Pin-Priority: 990

Package: apache2-utils
Pin: release n=stretch
Pin-Priority: 990

Package: apache2-doc
Pin: release n=stretch
Pin-Priority: 990

Package: apache2-suexec-pristine
Pin: release n=stretch
Pin-Priority: 990

Package: *
Pin: release n=stretch
Pin-Priority: -1

Save and exit, then:

apt remove apache2-suexec

(do not worry, it is only a transitional package which is present only in Jessie, we need to remove it to upgrade all apache2 packages to Stretch)

apt update
apt list --upgradable

If you did everything right, in the list you should see only apache2, apache2-bin, apache2-data, apache2-utils, apache2-doc and apache2-suexec-pristine packages. If yes, upgrade them:

apt upgrade

Check if all Apache packages have been correctly upgraded to 2.4.23:

dpkg -l apache2* | grep ii

2) Install other required packages and enable required Apache modules

apt install python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup
a2enmod proxy_fcgi
a2enmod proxy_http
service apache2 restart

(you should have already enabled mod_rewrite during your ISPConfig installation)

UPDATE: If you have to install Seafile Pro, you should install also the following additional packages:

apt install openjdk-8-jre-headless poppler-utils libpython2.7 python-pip python-setuptools python-imaging python-memcache python-ldap python-urllib3

sudo pip install boto requests
sudo ln -sf /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java /usr/bin/

3) Clean previous Seafile installation

If you already installed Seafile on your server and then deleted it, before reinstalling it, do not forget to remove seahub cache files:

rm -R /tmp/seahub_cache/

otherwise you may experience css problems on your new Seafile website.

4) Configure ISPConfig

Login to your ISPConfig control panel:

a) Go to System -> Firewall, edit your existing firewall record and add ports 8000 and 8082

b) Go to Sites->Website->Add new website, and create a new website (like with SSL enabled (do not forget to create the SSL certificate in the SSL tab), and in the Options tab add these Apache Directives (don’t forget to replace the text in red with your real domain name):

Alias /media /var/www/

RewriteEngine On
KeepAlive Off

<Location /media>
Require all granted

# seafile httpserver
ProxyPass /seafhttp
ProxyPassReverse /seafhttp
RewriteRule ^/seafhttp - [QSA,L]

# seahub
SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
ProxyPass / fcgi://

SetEnv proxy-nokeepalive 1
SetEnv proxy-sendchunks 1

SetEnv no-gzip 1

KeepAlive,  proxy-nokeepalive and proxy-sendchunks settings are required to avoid connection timeout problems in case of big files to upload and slow internet connection on client side.

The no-gzip setting is required to mitigate the BREACH attack risk.

c) Go to Sites->Shell-User->Add new Shell-User and add a user named “_seafile” for your newly created website (do not forget the underscore, since ISPConfig always puts a prefix before) . Set only the Site field and leave default settings (particularly, leave Chroot Shell to “None”).

d) Go to Sites->Database User->Add new User and add a user named “_seafile” (do not forget the underscore).

e) Go to Sites->Databases->Add new database and create three new databases, named “_ccnetdb”, “_seafiledb”, “_seahubdb”; for each database, choose the Database User you created before and set Database Charset to “UTF-8”

f) Go to Email->Email Mailbox, and create an email address from which your Seafile Server will send notifications to users (create a new email domain before, if it is necessary)

5) Install Seafile

Go to Seafile download page, and copy the link of the Seafile Server version you want to install (64 or 32 bit, v5 or v6 etc).

Then go back to the terminal, as root (replace the text in red with the actual name of the Shell-User you created with ISPConfig, and replace the text in blue with the link you copied above):

su default_seafile
cd $HOME/../../private/
mkdir seafile
cd seafile
tar zxvf seafile-server_6.0.4_x86-64.tar.gz
mkdir installed
mv seafile-server_* installed
cd seafile-server-*

(UPDATE: if you have to install Seafile Pro, change the “wget” command above with the command you find in the “how-to-download-via-wget.txt” file inside the Seafile Pro download directory, and instead of seafile-server_* and seafile-server-* you have to type seafile-pro-server_* and seafile-pro-server-*)

At this point you have to answer some questions about your system and installation. When you are asked “Please Choose a way to initialize seafile databases” you have to select 2 and input the database information from your ISPConfig setup (do not forget the prefix put by ISPConfig before database names and to database user; it should be something like “c0_seafile” or the like).

Finally, try to start your newly installed Seafile server (always as the Shell-User you created with ISPConfig)

./ start
./ start

(you will be asked to create the admin account by choosing a username/email and a password; choose a temporary password at this stage, since you will have to login via http the first time)

Open the browser and try if it works by opening the page  (replace the red part with the actual domain name of your Seafile server), and logging in as admin.

Then stop the server:

./ stop
./ stop

6) Enable SSL/HTTPS and email notifications

Finally, you have to modify some Seafile configuration files in order to enable SSL. Stay logged in as the Shell-User you created with ISPConfig, and type:

cd $HOME/../../private/seafile/conf
nano ccnet.conf

and change this line as follows (do not forget to replace the part in red with your real domain name)


Save and exit, then:


Add the following lines (replace the part in red with your seafile server’s actual domain name, and the parts in blue with the login data of the email account you have created before)


EMAIL_HOST = 'localhost'

Save and exit, then:

cd $HOME/../../private/seafile/seafile-server-latest
./ start
./ start-fastcgi

Ok, now you can try to login as admin user at (replace the text in red etc.) and change your temporary password.

Now your Seafile server is up and running!

7) Add a cron job to start your Seafile Server at startup

Following the guide I mentioned at the beginning, it seems that it is not enough to simply put the commands above in a Cron Job in ISPConfig, but I still have to check this part 🙂

I will update this guide as soon as I have tested a stable solution.

While still logged in as the Seafile shell user, create a simple startup script:

cd $HOME

Write the following text (replace the text in red with your actual domain name):

sleep 60
cd /var/www/
./ start && ./ start-fastcgi

Save and exit, then make the file executable:

chmod +x

(Before proceeding, if your Seafile website “belongs” to a particular ISPConfing “Client” (meaning “Customer”), do not forget to allow such “Client” to create any type of Cron Jobs: go to the “Limits” tab of the “Client”, expand “Cron Job Limits” and set “”Max allowed cronjob types” to “Full Cron”)

Then in your Ispconfig control panel go to Sites->Cron Jobs->Add new Cron Job.

As Parent Website, choose your Seafile site; set “Minutes”, “Hours” and “Days of month” to * (asterisk), “Months” to @reboot, and “Days of week to” * (asterisk); finally, set “Command to run” to:


(replace the text in red with your actual Seafile domain name, and the text in green with your actual Seafile shell user name)

Check that the “Active” option is flagged,  click on “Save” and than wait 5 minutes to be sure that Ispconfig saves the cron job.

Then reboot your server, and wait 1 minute after reboot before checking that your Seafile server is up an running.