Serving an iPhone website with nginx

mike mike503 at
Tue Jan 13 01:40:24 MSK 2009

On Mon, Jan 12, 2009 at 2:19 PM, Nick Pearson <nick.pearson at> wrote:

> While recently working on an iPhone website, I found I had some seemingly
> common requirements but couldn't find any good write-ups on how to serve
> such a site with nginx.  While it's of course just a "normal" website, I
> wanted to redirect iPhone users to an optimized version of the site while
> still allowing them to get back to the full site if necessary.  I also
> needed to serve two versions of the same page from a mobile-optimized
> website for the same URL (an iPhone version and a standard mobile version,
> based on user agent) while allowing each version of the page to be cached
> independently.

I would just do this in the application (PHP, etc.) level.

You could in theory do something funky with user agents in nginx and
do some rewrites or proxy to something else, or try to leverage the
XSL/XML capabilities nginx has. Otherwise I see no reason for nginx to
be invovled in this and would suggest to everyone to do this kind of
work in the application layer.

More information about the nginx mailing list