1

I tried the last days to run current Seafile 6.0.5 with MySQL on my VPS with Plesk Onyx 17 installed.

If I follow the official seafile.com manual => https://manual.seafile.com/deploy/deploy_with_nginx.html

I can open the webui from: http:IP_ADRESS:8000.

But when I add NGINX config and start seahub in fastcgi mode to reach Seafile under: https://seafile.mydomain.com (lets-encrypt https), I only see the seafile logo in the left upper corner, a non working language selector in the right upper corner and a text which says: "Sorry but the requested page was not found".

My logs/seahub_django_request.log:

2016-11-03q 04:51:11,438 [WARNING] django.request:170 get_response Not Found: /index.html
2016-11-03 04:51:13,204 [WARNING] django.request:170 get_response Not Found: /index.html
2016-11-03 04:58:06,150 [WARNING] django.request:170 get_response Not Found: /index.html
...

My ccnet.conf:

[General]
USER_NAME = PrivateSeafile
ID = id
NAME = PrivateSeafile
SERVICE_URL = https://seafile.mydomain.com

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = seafile
PASSWD = pass
DB = ccnet-db
CONNECTION_CHARSET = utf8

My seahub_settings.py:

SECRET_KEY = "secret"

FILE_SERVER_ROOT = 'https://seafile.mydomain.com/seafhttp'
#SITE_BASE = 'https://seafile.mydomain.com'
#SITE_ROOT = '/'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': 'pw',
        'HOST': '127.0.0.1',
        'PORT': '3306'
    }
}

My additional nginx settings in Plesk read as follows:

server_tokens off;
proxy_set_header X-Forwarded-For $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

location ~ / {
    if ($scheme = http) {
        return 301 https://$http_host$request_uri?;
    }
    fastcgi_pass    127.0.0.1:8000;
    fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
    fastcgi_param   PATH_INFO           $fastcgi_script_name;

    fastcgi_param   SERVER_PROTOCOL     $server_protocol;
    fastcgi_param   QUERY_STRING        $query_string;
    fastcgi_param   REQUEST_METHOD      $request_method;
    fastcgi_param   CONTENT_TYPE        $content_type;
    fastcgi_param   CONTENT_LENGTH      $content_length;
    fastcgi_param   SERVER_ADDR         $server_addr;
    fastcgi_param   SERVER_PORT         $server_port;
    fastcgi_param   SERVER_NAME         $server_name;
    fastcgi_param   HTTPS               on;
    fastcgi_param   HTTP_SCHEME         https;

    access_log      /var/log/nginx/seahub.access.log;
    error_log       /var/log/nginx/seahub.error.log;
    fastcgi_read_timeout 36000;
}

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass https://127.0.0.1:8082;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;
    proxy_request_buffering off;
}

location /seafdav {
    fastcgi_pass    127.0.0.1:8080;
    fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
    fastcgi_param   PATH_INFO           $fastcgi_script_name;

    fastcgi_param   SERVER_PROTOCOL     $server_protocol;
    fastcgi_param   QUERY_STRING        $query_string;
    fastcgi_param   REQUEST_METHOD      $request_method;
    fastcgi_param   CONTENT_TYPE        $content_type;
    fastcgi_param   CONTENT_LENGTH      $content_length;
    fastcgi_param   SERVER_ADDR         $server_addr;
    fastcgi_param   SERVER_PORT         $server_port;
    fastcgi_param   SERVER_NAME         $server_name;
    fastcgi_param   HTTPS               on;
    client_max_body_size 0;
    proxy_request_buffering off;

    access_log      /var/log/nginx/seafdav.access.log;
    error_log       /var/log/nginx/seafdav.error.log;
}

location /media {
    root /home/seafile/haiwen/seafile-server-latest/seahub;
}

location /.well-known/acme-challenge {
    root /var/www/vhosts/mydomain.com/seafile.mydomain.com;
}

I hope some one has an Idea how to solve it. I know thats something with Plesk, because I deployed seafile many times with raw nginx and worked perfectly.

lrecknagel
  • 317
  • 3
  • 14

1 Answers1

1

So I solved it by creating a custom nginx virtual domain-host configuration for Plesk Onyx.

To do so:

mkdir /usr/local/psa/admin/conf/templates/custom
mkdir /usr/local/psa/admin/conf/templates/custom/domain
cd /usr/local/psa/admin/conf/templates/custom/domain
cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php ./

vim nginxDomainVirtualHost.php

remove or comment the following:

location ~ /$ {
    <?php echo $VAR->domain->physicalHosting->proxySettings['directoryIndex'] ?>
}

Plesk Documentation say:

Generate new configuration files: via:

httpdmng --reconfigure-domain YOUR_DOMAIN

But on console respond with

command httpdmng not found

So simply open your domain Apace & nginx Settings in Plesk and click okay.

Other small issue of the additional nginx config wich break the sync with local clients:

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass https://127.0.0.1:8082;

has to be:

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    proxy_pass http://127.0.0.1:8082;

so only http instead of https.

Hope that helps anyone else ;)

lrecknagel
  • 317
  • 3
  • 14