How to use ISPConfig and Seafile without manual file modifications

Seafile ISPConfig Tutorial Seafile is an open-source cloud based file storage system similar to Dropbox & Box. The difference is that Seafile can be deployed on a client's own system. This provides a greater safety and security factor as the passwords are only interchanged between the client who setup the system, and his / her own users rather than a corporate cloud hosting company.

There are a few Seafile server setup tutorials for ISPConfig, but none that didn't require a good majority of editing the files that should really be left alone as per ISPConfig developer recommendations. While this setup is written for Ubuntu 14.04 LTS and ISPConfig 3, it can be followed for other distrobutions. This solution works for me, but no guarantee or warranty is expressed or implied.

It is assumed that the reader is wanting to deploy Seafile using MySQL and Apache (also https). It is also assumed that you can functionally use ISPConfig, as this is not an ISPConfig tutorial.

1 Setup Website

Open your ISPConfig hosting control panel, click on the Sites tab, and create a new website. While you can technically use an existing website, creating a new one works better as it allows us to keep all the cloud files separated from other sites. This also is necessary to use the ISPConfig panel for configuration changes.

In the website configuration panel, click the Options tab and insert the following in Apache Directives section:
Alias /media /var/www/

RewriteEngine On

<Location /media>
Require all granted

# seafile httpserver
ProxyPass /seafhttp
ProxyPassReverse /seafhttp
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}]
You should also create a shell user for this site as it will be necessary shortly.

ssh user

2 Create Databases

From the Sites panel in ISPConfig, select Database User and Add new User. Create a single user per client that will manage that client's seafile databases.

db user

 After the database user is created, click Databases, and Add new Database. You will need to add three seperate databases: ccnetdbseafiledbseahubdb

db 2
db 3

3 Download and Install Seafile software

There are some required packages that we need to install. SSH into your website and execute the following commands:

apt-get install python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup

I prefer to have all my servers running inside the private directory rather than the web directory, so we'll setup as such.

cd private
mkdir seafile
cd seafile

    or for 32bit

tar zxvf seafile-server_3.1.6_x86-64.tar.gz
mkdir installed
mv seafile-server_* installed

cd seafile-server-*

At this point you'll need to answer the prompted questions as they relate to your system and installation. When you get to the section titled Please Choose a way to initialize seafile databases you'll need to select 2 and input the database information from your ISPConfig setup.

4 Initial Run

It's time to start seafile and make sure the initial setup is working.

./ start
./ start

After starting the services, open your web browser and navigate to the website address you created above with port 8000.

5 Apache Setup

Most of our setup for Apache is actually done inside the website setup above. However, we need to add a line to the apache.conf for everything to work smoothly. Unfortunately, I have not found a way to add this without editing this single file.

sudo echo "## Seafile External Server" >> /etc/apache2/apache.conf
sudo echo "FastCGIExternalServer /var/www/ -host" >> /etc/apache2/apache.conf

Now modify the SERVICE_URL in /path/to/seafile-server/ccnet/ccnet.conf


We'll also need to modify the FILE_SERVER_ROOT in /path/to/seafile-server/


Restart Apache.

sudo service apache2 restart

Restart Seafile services.

./ start
./ start-fastcgi

6 Enable HTTPS

The only thing that needs to be done is generating a SSL key from inside the Sites tab of ISPConfig. Because of the way ISPConfig is installed and operates, everything else should already be setup. You may need to make sure Apache gets restarted though.

7 Start services automatically 

Since the goal here is to keep everything contained with ISPConfig, rather than creating a startup service, we're going to add the seafile script to the users cron jobs. Naturally, you'll need to make sure that the client has the ability to add full cron jobs. Make sure that you add two different cron jobs; one for seafile and one for seahub. Insert the following in the Command to Run section:

/var/www/clients/client1/web42/private/seafile/seafile-server-3.1.6/ start-fastcgi

UPDATE (November 23, 2014) : Because it takes a while for the seafile & seahub servers to start, there were occasions where the second script would run before the previous script finished. Thus the server wouldn't start. I've updated the original seafile startup script to properly work with ISPConfig. I've probably overdone it on the wait commands, but the script works well using them. Make sure you're logged in as the seafile user prior to running the following commands.

Create a startup file:

cd ~/private/seafile
chmod +x

Paste the following code into the script:


# Change the value of "seafile_dir" to your path of seafile installation

# Change the value of fastcgi to true if fastcgi is to be used
# Set the port of fastcgi, default is 8000. Change it if you need different.

## Sleep command is necessary to prevent MYSQL errors if
## this script runs before MYSQL is fully operational
sleep 60 &
wait %1

case "$1" in
                ${script_path}/ start >> ${seafile_init_log} &
                wait %1
                if [  $fastcgi = true ];
                        ${script_path}/ start-fastcgi ${fastcgi_port} >> ${seahub_init_log} &
                        wait %1
                        ${script_path}/ start >> ${seahub_init_log} &
                        wait %1
                ${script_path}/ restart >> ${seafile_init_log} &
                wait %1
                if [  $fastcgi = true ];
                        ${script_path}/ restart-fastcgi ${fastcgi_port} >> ${seahub_init_log} &
                        wait %1
                        ${script_path}/ restart >> ${seahub_init_log} &
                        wait $1
                ${script_path}/ $1 >> ${seafile_init_log}
                ${script_path}/ $1 >> ${seahub_init_log}
                echo "Usage: /etc/init.d/seafile {start|stop|restart}"
                exit 1

Now you will only need to add the single cron job into the Commands to Run section of ISPConfig:

/var/www/clients/client1/web42/private/seafile/ start

cron jobs

Thats it!

Share this page:

6 Comment(s)

Add comment


From: Bubanet

And nginx
send mail


Not really an nginx fan. If you work out the procedure and I can duplicate fairly easily I'll edit the tutorial and credit you.


I followed this install, except installing on new site, I installed under new folder of existing site. Is that possible? I'm having issues, any ideas how to troubleshoot? How can I access web interface? I have Debian 7 64-bit server with myswl + apache.


From: nikolaosp

Thank you very much for the amazing tutorial.  The only issue I seem to be having is that there are no graphics on the webpage.  There is only links and no formatting. Something wrong with the PHP? Also is there any reason that we need to use the fastcgi option? is php-fpm not good?

Thank you again for your work

From: concept21

Hello Friend, where do you actually store the seahub files?  Are they on on a public web folder?

Yours Faithfully.

From: Alberto

Thank you so much for this guide!

However, given the time passed, it should be updated. With the latest version of seafile (5.1.4) some things are different.

1) The good news is that no manual modification of apache2.conf is required any more, so you can have a "clean" install of seafile on ispconfig. So that part of the guide must be skipped.

2) The seahub part of the Apache Directives has to be replaced by the following:

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

3) You have to enable proxy_fcgi and proxy_http apache modules (also rewrite module is required, but you should have already enabled it when configuring your ispconfig server;  fastcgi module is not required anymore)

sudo a2enmod proxy_fcgi sudo a2enmod proxy_http

4) ccnet.conf and files are inside the private/seafile/conf directory now

5) to enable https you also have to modify the above-mentioned files as follows:





where '' has to be replaced by the actual domain name of your the site you have created in ispconfig.

6) You have to enable ports 8000 and 8082 on the ispconfig firewall config page.