nginx proxy_pass 并为 seafile 代理重写

nginx proxy_pass and rewrite for seafile proxy

我是 运行 Plesk 虚拟机 (public) 后面的 Seafile 虚拟机(专用网络)。

现在我正在使用 apache 作为代理,但想知道如何获得此设置 运行 只有 nginx。

这个有效:

RewriteEngine On

ProxyPass /seafhttp http://192.168.10.102:8082
ProxyPassReverse /seafhttp http://192.168.10.102:8082
RewriteRule ^/seafhttp - [QSA,L]

RewriteRule ^/(.*) http://192.168.10.102:8000/ [P]
ProxyPassReverse  / http://192.168.10.102:8000/

这不是:

location /seafhttp {
    rewrite ^/seafhttp(.*)$  break;
    proxy_pass http://192.168.10.102:8082;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;
}

location ~ / {
    proxy_pass http://192.168.10.101:8065;
}

但这再次起作用:

RewriteEngine On

RewriteRule ^/(.*) http://192.168.10.102:8000/ [P]
ProxyPassReverse  / http://192.168.10.102:8000/

+

location /seafhttp {
    rewrite ^/seafhttp(.*)$  break;
    proxy_pass http://192.168.10.102:8082;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;
}

我在这里错过了什么?

谢谢 最大值

修正如下:

location ^~ /seafhttp {
    rewrite ^/seafhttp(.*)$  break;
    proxy_pass http://192.168.10.102:8082;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;
}

location ~ / {
    proxy_pass http://192.168.10.102:8000;
}