<div dir="ltr"><div><div class="gmail_signature"><div dir="ltr"><div><div>I'm going nuts on this. Any help would be much appreciated.</div><div><br></div><div>The $request_uri</div><div><br></div><div>/h_32/w_36/test.jpg</div><div><br></div><div>needs to be routed to</div><div><br></div><div>/index.php/img/i/h_32/w_36/test.jpg</div><div><br></div><div>index.php will route the request to the "img" controller and "i" method, then process the image and return it. However, my MVC works off of the REQUEST_URI. So simply rewriting the url will not work. The REQUEST_URI needs to modified. </div><div><br></div><div>You can see in the last location block that I'm passing in the modified REQUEST_URI, but Nginx is trying to open /var/www/vhosts/<a href="http://ezrshop.com/htdocs/h_32/w_36/test.jpg">ezrshop.com/htdocs/h_32/w_36/test.jpg</a> (see **Error Logs** below) and throwing a 404. </div><div><br></div><div>Shouldn't Nginx be trying to send it for processing to index.php?? Why the 404?</div><div><br></div><div>In a browser, if I go directly to <a href="https://www.example.com/img/i/h_32/w_36/test.jpg">https://www.example.com/img/i/h_32/w_36/test.jpg</a> the page comes up just fine. If I try to go to <a href="https://www.example.com/h_32/w_36/test.jpg">https://www.example.com/h_32/w_36/test.jpg</a> in my browser I get 404 and the **Error Logs** you can see below.</div><div><br></div><div>    root /var/www/vhosts/<a href="http://example.com/htdocs">example.com/htdocs</a>;</div><div>    index index.php index.html;</div><div>    </div><div>    set $request_url $request_uri;</div><div>    </div><div>    location ~ (h|w|fm|trim|fit|pad|border|or|bg)_.*\.(jpg|png)$ {</div><div>    <span style="white-space:pre">        </span>if ($request_uri !~ "/img/i/") {</div><div>    <span style="white-space:pre">                      </span>set $request_url /index.php/img/i$1.$2;</div><div>    <span style="white-space:pre"> </span>}</div><div>    </div><div>    <span style="white-space:pre"> </span>try_files $uri $uri/ /index.php/img/i$1.$2;</div><div>    }</div><div>    </div><div>    location / {</div><div>    <span style="white-space:pre">                </span>try_files $uri $uri/ /index.php$uri?$args;</div><div>    }</div><div>    </div><div>    location ~ ^(.+\.php)(.*)$ {</div><div>    <span style="white-space:pre">         </span>fastcgi_pass   <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;</div><div>    <span style="white-space:pre">               </span>fastcgi_param  CI_ENV production; #CI environment constant</div><div>    <span style="white-space:pre">             </span>fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;</div><div>    <span style="white-space:pre">           </span>include fastcgi_params;</div><div>    <span style="white-space:pre">         </span>fastcgi_param  REQUEST_URI $request_url;</div><div>    }</div><div><br></div><div>**Error Logs:**</div><div><br></div><div>**Log 1:** "/img/i/" does not match "/h_32/w_36/test.jpg", request: "GET /h_32/w_36/test.jpg HTTP/1.1"</div><div><br></div><div>**Log 2:** open() "/var/www/vhosts/<a href="http://ezrshop.com/htdocs/h_32/w_36/test.jpg">ezrshop.com/htdocs/h_32/w_36/test.jpg</a>" failed (2: No such file or directory), request: "GET /h_32/w_36/test.jpg HTTP/1.1"</div></div></div></div></div>
</div>