I have this store running on Apache, Magento 1.7.0.2
Then I decided to clone the application on a test server, running Nginx.
I first tried mine, naive rewrite:
rewrite ^(.*index\.php)\/(.*) $1?$2 last;
This worked, although not in the entire store. Recent viewed product pages didn't. They resulted in 404 by nginx.
Then I followed the steps outlined in: http://www.howtoforge.com/running-magento-1.6.0.0-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04
My server configuration was updated. Then, nothing worked, and the 404 error was from Magento in every link (instead of nginx 404).
Can you please confirm that the above link configuration is good ? Notice that I just cloned the files from production server to the test server (didn't install Magento). It will be really nice if re-install isn't necessary.
I already updated web/unsecure/base_url
and web/secure/base_url
on the database.
Best Answer
I've posted a working sample config below. Included is a set of rewrite rules that allows us to serve up static html pages from the "static" directory. If we're advertising a product like http://yourdomain.com/super-popular.html that we expect many thousands of concurrent hits to, we may opt to save the html of super-popular.html in the static directory to skip php entirely. Nginx absolutely crushes Apache in serving up these pages in particular.
We've experienced rock solid performance with the config below.