nginx proxy_pass并重写seafile代理

时间:2016-06-13 19:18:00

标签: mod-rewrite proxy reverse-proxy nginx-location seafile-server

我正在Plesk vm(公共)后面运行一个seafile vm(私人网络)。

现在我正在使用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/$1 [P]
ProxyPassReverse  / http://192.168.10.102:8000/

这不是:

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 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/$1 [P]
ProxyPassReverse  / http://192.168.10.102:8000/

+

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 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;
}

我在这里缺少什么?

由于 最大

1 个答案:

答案 0 :(得分:1)

修正如下:

location ^~ /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 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;
}