Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Nginx/OwnCloud请求发送到错误目录_Php_Nginx_Owncloud - Fatal编程技术网

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

Php Nginx/OwnCloud请求发送到错误目录,php,nginx,owncloud,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/oc

我有一台运行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提供者都位于云目录中,该目录位于www目录中。基本上,对这些文件夹的请求都指向上面的目录

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

  'trusted_domains' =>
  array (
    0 => 'cloud.domain.com',
    1 => 'domain.com',
  ),
  'overwrite.cli.url' => 'https://cloud.domain.com/',
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;
  }
对于我的cloud.domain.com vhosts配置,我有以下内容:

  'trusted_domains' =>
  array (
    0 => 'cloud.domain.com',
    1 => 'domain.com',
  ),
  'overwrite.cli.url' => 'https://cloud.domain.com/',
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;
  }
}


关于为什么我的请求被放错了地方,以及我能做些什么来纠正,你有什么想法吗?我的点子快用完了(

你能尝试
返回301 https://$host$request\u uri;
而不是302.Config看起来很好。我用同样的方式运行它,它对我有效。你能尝试
返回301 https://$host$request\u uri;
而不是302.Config看起来很好。我用同样的方式运行它,它对我有效。