I’m trying to use the Dropbox public folder and my nginx server as a
upstream server to server static files. I’m hoping someone can point me
in
the right direction or tell me what I’m doing wrong.
So:
my.domain.net/u/#########/.bz2 serves from
http://dl.dropbox.com/u/#########/*.bz2 “twice” as much as
my.domain.net/u/#########/.bz2
It seems when the server uses the x.x.x.x:80 it loops and hits the
proxy_pass directive over and over resulting in a 500 error.
Any help is appreciated!
Here is what my configuration looks like:
upstream backend {
server x.x.x.x:80 weight=1 max_fails=2;
server dl.dropbox.com:80 weight=2 max_fails=2;
}
server {
listen 80;
server_name my.domain.net www.my.domain.net;
root /path/to/my/root/;
location /u/#########/ {
autoindex on;
autoindex_exact_size off;
}
location ~* ^.+.(bz2|bsp|nav)$ {
proxy_pass http://backend;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Posted at Nginx Forum:
Hello!
On Thu, Apr 11, 2013 at 04:15:02AM -0400, winniethepooh wrote:
proxy_pass directive over and over resulting in a 500 error.
Any help is appreciated!
Here is what my configuration looks like:
upstream backend {
server x.x.x.x:80 weight=1 max_fails=2;
server dl.dropbox.com:80 weight=2 max_fails=2;
}
It’s not clear why you added “x.x.x.x” to the upstream block if
it’s not an upstream but the same server. Obvious solution would
be to remove it.
If you try to implement “check the local disk, and if the file
isn’t there - proxy to dropbox” logic, correct solution would be
to use something similar to an example provided at
http://nginx.org/r/error_page:
location / {
error_page 404 = @fallback;
}
location @fallback {
proxy_pass http://backend;
}
–
Maxim D.
http://nginx.org/en/donation.html
Maxim D. Wrote:
to use something similar to an example provided at
Maxim D.
nginx: donation
Hey, thanks for your reply! I have the same files stored both at
/path/to/my/root/* and at http://dl.dropbox.com/u/#########/*. The same
folder structure and everything.
What I want is to “load balance” between dropbox and the same nginx site
(x.x.x.x) so both places can serve files.
Is the only way to do this to split up the proxy as one server block on
one
port (80 for example) and the actual server block hosting the files in
another server block on a different server port (8080 for example)?
Or can I modify the originally posted setup to do what I want?
Thanks again.
Posted at Nginx Forum:
Hello!
On Thu, Apr 11, 2013 at 11:08:47AM -0400, winniethepooh wrote:
If you try to implement "check the local disk, and if the file
}
(x.x.x.x) so both places can serve files.
Ok, so you are you trying to save disk bandwidth at cost of
network one.
Is the only way to do this to split up the proxy as one server block on one
port (80 for example) and the actual server block hosting the files in
another server block on a different server port (8080 for example)?
Or can I modify the originally posted setup to do what I want?
Using distinct server blocks is most simple option.
–
Maxim D.
http://nginx.org/en/donation.html