【问题标题】:Seafile 6.0.5 404 WebUI with nginx and Plesk OnyxSeafile 6.0.5 404 WebUI 与 nginx 和 Plesk Onyx
【发布时间】:2016-11-03 08:30:59
【问题描述】:

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

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

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

但是当我添加 NGINX 配置并以 fastcgi 模式启动 seahub 以到达 Seafile 下:https://seafile.mydomain.com(lets-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 并且运行良好。

【问题讨论】:

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


    【解决方案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 文档说:

    生成新的配置文件:通过:

    httpdmng --reconfigure-domain YOUR_DOMAIN
    

    但在控制台上响应

    找不到命令 httpdmng

    因此,只需在 Plesk 中打开您的域 Apace 和 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。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-19
      • 1970-01-01
      • 2015-02-20
      • 1970-01-01
      • 2020-04-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多