Seafile 6.0.5 404 WebUI 与 nginx 和 Plesk Onyx

Seafile 6.0.5 404 WebUI with nginx and Plesk Onyx

我最近几天在安装了 Plesk Onyx 17 的 VPS 上尝试 运行 当前的 Seafile 6.0.5 MySQL。

如果我按照官方seafile.com手册=> https://manual.seafile.com/deploy/deploy_with_nginx.html

我可以从以下位置打开 webui:http:IP_ADRESS:8000。

但是当我添加 NGINX 配置并以 fastcgi 模式启动 seahub 以访问 Seafile 时:https://seafile.mydomain.com (lets-encrypt https),​​我只看到左上角的 seafile 标志,一种非工作语言右上角的选择器和一个文本:"Sorry but the requested page was not found".

我的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
...

我的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

我的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'
    }
}

我在 Plesk 中的其他 nginx 设置如下:

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(.*)$  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;
}

我希望有人知道如何解决它。我知道这与 Plesk 相关,因为我使用原始 nginx 多次部署 seafile 并且运行良好。

所以我通过为 Plesk Onyx 创建自定义 nginx 虚拟域主机配置解决了这个问题。

这样做:

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

删除或评论以下内容:

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

Plesk 文档说:

Generate new configuration files: via:

httpdmng --reconfigure-domain YOUR_DOMAIN

但在控制台上响应

command httpdmng not found

所以只需在 Plesk 中打开您的域 Apace 和 nginx 设置,然后单击确定。

其他 nginx 配置的其他小问题会破坏与本地客户端的同步:

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

必须是:

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

所以只有 http 而不是 https。

希望对其他人有所帮助 ;)