Take the 2-minute tour ×

I'm looking for a way to set a parameter in my browser or some sort of token that allows nginx to select the site that is going to serve.

I wish to put the configuration in the nginx sites-enabled folder. Something like

/etc/nginx/sites-enabled/example.com-construction   <- The site regular people would get
/etc/nginx/sites-enabled/example.com                <- The site I'll get

The second site only applies for connections comming from specific users (no more than 10) marked by a param in their browser.

share|improve this question
add comment

1 Answer

You can use the HttpGeoModule for this. http://wiki.nginx.org/NginxHttpGeoModule

geo $geo {
    default 0;
    yourIPHere 1;

Then in your configuration, you can put...

if ($geo) { 
    # Then you can put rewrite or any other configuration here.
    # could use a rewrite, root, etc.
share|improve this answer
add comment

Your Answer


