I need NGINX to proxy a certain directory to an external S3 bucket, which I'm doing like so:
location ~ ^/logos/(.*)$ {
proxy_pass https://s3-us-west-2.amazonaws.com/mybucket/logos/$1;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
}
I also need all other URIs to go to a wildcard CGI script. I'm doing like this:
location ~ \.cgi$ {
include fcgiwrap.conf;
}
rewrite ^ /myscript.cgi;
The problem is, when I put both in the same server {} declaration, they seem to be mutually exclusive. Either everything under /logos/* gets routed to the CGI script, or the CGI script gets a 404.
Yep that did the trick: