nginx反向代理文件夹403错误

nginx反向代理文件夹403错误,nginx,docker,proxy,reverse,Nginx,Docker,Proxy,Reverse,我将nginx作为直接安装在服务器上的反向代理运行。要访问不同的Web应用程序,我正在使用子文件夹。两个webapp在docker容器中运行(pydio和cops) 对于pydio,此位置命令正在工作;对警察来说,同样的方法不管用 location ^~ /pydio { client_max_body_size 20G; proxy_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeou

我将nginx作为直接安装在服务器上的反向代理运行。要访问不同的Web应用程序,我正在使用子文件夹。两个webapp在docker容器中运行(pydio和cops)

对于pydio,此位置命令正在工作;对警察来说,同样的方法不管用

   location ^~ /pydio {
    client_max_body_size 20G;
    proxy_connect_timeout 300;
    proxy_send_timeout 300;
    proxy_read_timeout 300;
    send_timeout 300;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://127.0.0.1:82;
    proxy_redirect off;
}
我尝试了通过搜索找到的不同设置-没有一个有效

这是导致403错误的最新版本:

   location ^~ /ebooks(.*)$ {
    client_max_body_size 1G;
    proxy_connect_timeout 300;
    proxy_send_timeout 300;
    proxy_read_timeout 300;
    send_timeout 300;
    rewrite ^/ebooks(/.*)$ $1 break;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://192.168.100.67:83$1/;
    proxy_redirect off;
    autoindex on;
}
以及my error.log中的以下条目:

[错误]29235#29235:*1目录索引“/var/www/ebooks/”被禁止,客户端:87.174.111.111,服务器:myaddress.de,请求:“GET/ebooks/HTTP/1.1”,主机:“myaddress.de”

当我直接在浏览器中点击192.168.100.67:83时,一切正常

文件夹/var/www/ebooks具有www-data:www-data和750权限,并通过运行命令与容器链接:

docker运行-v/var/www/ebooks:/config
。。。据此,

希望我把问题说清楚,你会帮助我。谢谢


好消息是坏消息

经过测试,我发现设置正确地将命令传递给docker

    location ^~ /ebooks {

        proxy_connect_timeout 300;
        proxy_send_timeout 300;
        proxy_read_timeout 300;
        send_timeout 300;
        rewrite ^/ebooks(/.*)$ $1 break;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:83$1;
        proxy_redirect off;
}
但cops页面仅以基本方式显示(背景颜色改变,但不显示矩阵)

这是错误日志条目:

上游响应在读取上游时缓冲到临时文件/var/lib/nginx/proxy/1/00/000000000 1,客户端:11.114.211.38,服务器:myaddress.de,请求::“GET/ebooks/resources/jQuery/jQuery-1.11.1..js?v=1.0.1 HTTP/1.1”,上游:,主机:“myaddress.de”,引用者:“

给你一个完整的画面。这是cops容器的nginx配置

    server {

    listen 80 default_server;
#   listen 443 ssl;
    server_name _;
#   ssl_certificate /config/keys/cert.crt;
#   ssl_certificate_key /config/keys/cert.key;
    access_log  /config/log/nginx/access_cops.log;
    error_log /config/log/nginx/error_cops.log;
    root   /var/www/localhost/cops;
    index index.php;

    #Useful only for Kobo reader
    location /cops/ {
          rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
          rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
          break;
        }

        #Can break loading the images - if you don't see anything, comment
        location ~ ^/images.*\.(gif|png|ico|jpg)$ {
                expires 31d;
        }
        #Can also break loading the images, comment if it happens
        location ~ .(js|css|eot|svg|woff|ttf)$ {
                expires 31d;
        }

    #Not necessarily correct, it depends on distro.
    location ~ \.php$ {
       include /etc/nginx/fastcgi_params;
       fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       fastcgi_pass    127.0.0.1:9000;
    }
location /books {
      root /;
       internal;
}
}

如果我遗漏了什么,你知道吗?

nginx是否在容器中运行?否,nginx在服务器上安装为“正常”。nginx是否在容器中运行?否,nginx在服务器上安装为“正常”。