Nginx / OwnCloud请求被发送到错误的目录

时间:2016-06-01 20:03:47

标签: php nginx owncloud

我有一台运行Nginx的服务器,其中包含OwnCloud实例。 Web服务器的根目录位于/data/domain.com/www/,OwnCloud文件的根目录为/data/domain.com/www/cloud/

OwnCloud页面加载完全正常,因此我可以浏览和上传文件。我有Z-Push工作,但我无法共享文件。当我去分享时,请求会根据错误发送到错误的目录:

2016/06/01 20:47:31 [error] 7758#0: *117 "/data/domain.com/www/ocs-provider/index.php" is not found (2: No such file or directory), client: 10.1.1.1, server: domain.com, request: "GET /ocs-provider/ HTTP/1.1", host: "domain.com"
2016/06/01 20:47:31 [error] 7758#0: *121 open() "/data/domain.com/www/ocs/v1.php/cloud/shares/36/unshare" failed (2: No such file or directory), client: 10.1.1.1, server: domain.com, request: "GET /ocs/v1.php/cloud/shares/36/unshare?format=json HTTP/1.1", host: "domain.com"

文件夹,ocs和ocs-provider都位于cloud目录中,该目录位于www目录中。基本上,对这些文件夹的请求指向上面的目录。

有趣的是,它将主机列为domain.com - 但OwnCloud实例是从cloud.domain.com运行的。我最初的想法是OwnCloud将请求指向错误的域,但在我的config.php中,对于OwnCloud我有以下内容:

  'trusted_domains' =>
  array (
    0 => 'cloud.domain.com',
    1 => 'domain.com',
  ),
  'overwrite.cli.url' => 'https://cloud.domain.com/',

对于我的cloud.domain.com vhosts配置,我有以下内容:

server {
        listen   80; ## listen for ipv4; this line is default and implied

        server_name cloud.domain.com;
        return 302 https://$host$request_uri;

        error_log /var/log/nginx_error.log error;
        access_log /var/log/nginx_access.log;

}

server {
        listen 443 ssl;
        server_name cloud.domain.com;
   #####ssl block


    client_max_body_size 10G;
    fastcgi_buffers 64 4K;

    gzip off;


    root /data/domain.com/www/cloud/;
    index index.php index.html index.htm;

    error_page 403 /core/templates/403.php;
    error_page 404 /core/templates/404.php;


    location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
    }

    error_log /var/log/nginx_error.log error;
    access_log /var/log/nginx_access.log;

    location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
            deny all;
    }

    rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
    rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
    rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;

    index index.php;

    location / {
            # The following 2 rules are only needed with webfinger
            rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
            rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

            rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
            rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;

            rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;

            try_files $uri $uri/ =404;
    }


    location ~ \.php(?:$|/) {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param HTTPS on;
            fastcgi_pass  unix:/var/run/php5-fpm.sock;
            fastcgi_intercept_errors on;
    }


    location ~* \.(?:css|js)$ {
        add_header Cache-Control "public, max-age=7200";
        # Add headers to serve security related headers
        add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
        add_header X-Content-Type-Options nosniff;
        add_header X-Frame-Options "SAMEORIGIN";
        add_header X-XSS-Protection "1; mode=block";
        add_header X-Robots-Tag none;
        # Optional: Don't log access to assets
        access_log off;
    }

  # Optional: Don't log access to other assets
        location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
        access_log off;
  }

}

关于为什么我的要求会走错地方以及我可以做些什么来纠正的任何想法?我的想法已经用完了! :(

0 个答案:

没有答案