1

Our setup is two servers:

  • One serves WP installation
  • The other one is used for extra custom functionality.

Server 1 that hosts WP is using Nginx as web server and reverse proxy to Server 2.

In Server 1 we have a simple location block for reverse proxy:

location /foo/ {
   proxy_pass        http://1.1.1.2/foo/;
   proxy_set_header  X-Real-IP  $remote_addr;
   proxy_set_header  Host       $host;
   proxy_redirect off;
   proxy_intercept_errors on;
}

In Server 2 we also have a location block because the platform requires a bit URL rewriting. It's a bit mixed bag because the platform loads some content via index.php?args but there's also static content:

location /foo/ {
   index index.php;
   try_files $uri $uri/ /foo/index.php?$args;
}

The problem we are facing is that while domain.com/foo/?bar, domain.com/foo/bar works great, domain.com/foo/img/photo.png gives 404.

I assume this is due try_files but I can't seem to get it working.

  • 1
    This wasn't about reverse proxy after all. There was another regex location block in Server 1 that trapped all image requests and they didn't make it to reverse proxy at all. Problem solved. – jimmy Feb 7 '14 at 8:36
  • 1
    Hi Jimmy, If this has been solved, please post your solution as an answer and tick it to complete this question. – Vasili Syrakis Feb 7 '14 at 8:42
  • No problem! Just letting you know, since this is your first question. Welcome to StackExchange. – Vasili Syrakis Feb 8 '14 at 13:05
0

This wasn't about reverse proxy after all. There was another regex location block in Server 1 that trapped all image requests and they didn't make it to reverse proxy at all. Problem solved.

posted again as an answer to mark the question as solved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.