Here is my server setup:<div><br></div><div>Amazon load balancer (<a href="http://loadbalancer.aws.com">loadbalancer.aws.com</a>) -> nginx servers in reverse-proxy/caching mode -> back end PHP servers</div><div><br></div>
<div>If I visit the nginx server directly in my browser, everything works perfectly.</div><div><br></div><div>If I visit <a href="http://loadbalancer.aws.com">loadbalancer.aws.com</a>, the nginx server redirects me to <a href="http://decupstream">http://decupstream</a>, which is what I named the upstream block in my configuration. The nginx.conf looks like:</div>
<div><br></div><div><div> upstream decupstream {</div><div> server <a href="http://10.167.1.50:8080">10.167.1.50:8080</a>;</div><div> server <a href="http://10.160.242.232:8080">10.160.242.232:8080</a>;</div>
<div> server <a href="http://10.222.218.126:8080">10.222.218.126:8080</a>;</div><div> }</div><div><br></div><div> proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=gop2012:10m;</div><div><br></div><div> server {</div>
<div> listen 80;</div><div> server_name <a href="http://gop-proxy.mycompany.com">gop-proxy.mycompany.com</a>;</div><div><br></div><div> location / {</div><div> proxy_pass <a href="http://decupstream">http://decupstream</a>;</div>
<div> proxy_cache gop;</div><div> proxy_cache_valid 10m;</div><div> proxy_cache_use_stale error timeout invalid_header http_500;</div><div> proxy_next_upstream error timeout invalid_header http_500;</div>
<div> proxy_cache_lock on;</div><div> proxy_ignore_headers<span class="Apple-tab-span" style="white-space:pre"> </span>Cache-Control Expires;</div><div> proxy_set_header Host "<a href="http://gop.mycompany.com">gop.mycompany.com</a>";</div>
<div> }</div><div> }</div></div><div><br></div><div><br></div><div>How do I get nginx to forward requests to the Apache/PHP servers even if they don't come in directly to the nginx box?</div><div><br></div><div>
-jsd-</div><div><br></div>