Seafile 6.0.5 404使用nginx和Plesk Onyx的WebUI

时间:2016-11-03 08:30:59

标签: nginx debian plesk lets-encrypt seafile-server

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

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

我可以从以下网址打开webui:http:IP_ADRESS:8000。

但是当我添加NGINX配置并以fastcgi模式启动seahub到达Seafile:https://seafile.mydomain.com(let-encrypt https)时,我只看到左上角的seafile徽标,一个非工作语言选择器右上角和一个文字说:“抱歉,但找不到请求的页面。”

我的日志/ 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(.*)$ $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;
}

我希望有人有一个想法如何解决它。我知道这与Plesk有关,因为我使用原始nginx多次部署了seafile并且工作得很好。

1 个答案:

答案 0 :(得分:1)

所以我通过为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文档说:

  

生成新的配置文件:via:

httpdmng --reconfigure-domain YOUR_DOMAIN

但是在控制台上回复

  找不到httpdmng命令

所以只需打开您的域名Apace&amp; Plesk中的nginx设置,然后单击“确定”。

额外的nginx配置的其他小问题,它打破了与本地客户端的同步:

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

必须是:

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

所以只有http而不是https。

希望能帮助其他人;)