Non-standard usage of nginx server for partially dynamic content
As far as I know nginx could be used for passing static content to user very quickly. My case is a bit complicated. At first request the content is dynamic but on second (same) request the content is static. To say very long story short: On first request I am generating data with PHP script which is saved (cached) in local directory. On next (same) request I want ngnix to pass that content directly to user (without calling PHP script).
I do not want to 'invent the bicycle'. There should be some logic which could solve my problem.
Thanks in advance.
Here is the solution I found so far. As you know there is a command in mod_rewrite which checks if requested file exist. This trick is used by WordPress to process all dynamic requests.
I am not sure if we are allowed to have IF statement within ngnix configuration file so let’s simplify the logic. Once we get requests, we calculate MD5 value of URL and redirect user to that new link. This new link will be handled again by ngnix and thus we can check if file under that URL exist (this could be done for sure). If it does not exist then we pass it to PHP script.
The only question I have: how can I generate MD5 value of URL within ngnix? Any solution which requires PHP is not acceptable.
Guys do you have any ideas?
|All times are GMT +1. The time now is 06:27 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.