Multilanguage Websites

Kasper Grubbe kasperg at benjamin.dk
Thu Dec 27 17:38:34 UTC 2012


I Think it is best for an Application to be webserver agnostic. That way it
does not matter what web server that is in front of your application.

There is cases where it makes sense to depend on NGINX for rewrites, but I
don't believe language is one of them.
For an example we run a big Ruby On Rails platform that hosts lots of
articles. We need to count the article hits every hour, and to do
article.hits = article.hits + 1 for every hit on an article hit.
To not stress our backend, and because hitting rails is costly, we do a
rewrite like this:
Http://site.com/article/15753/articlehit

Which is hitting a NodeJS application that does the before mentioned
operation and saves the result in memcache.

We do localization like this:
H = Hostname.find('kaspergrubbe.dk')
H.locale # returns 'da' for Danish locale

We then load up our i18n localization API with the locale and scope content
based on locale.

This solution is great for multiple domains. If you are not that fortunate
do site.com/:locale and if the locale is not there you could redirect the
user based on location/ip/etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20121227/ebd69a85/attachment.html>


More information about the nginx mailing list