Difficulty configuring virtual host

Paul G Webster opensource at interflective.com
Sun Mar 11 01:13:49 UTC 2012


Ahh smart it should work perfectly any way to set the server_name  
dynamically

On Sun, 11 Mar 2012 01:13:38 -0000, António P. P. Almeida  
<appa at perusio.net> wrote:

> On 11 Mar 2012 01h57 CET, opensource at interflective.com wrote:
>
>> Ideally doing this:
>>
>> if (srcip == 4.4.4.5) {
>> server_name test1;
>> root /usr/local/www/4.4.4.5;
>> } elsif (srcip == 2.2.2.2) {
>> server_name test2;
>> root /usr/local/www/2.2.2.2;
>> }
>
> Untested. Using the geo module [1]. At the http level.
>
> geo $root_dir {
>     4.4.4.5 /usr/local/www/4.4.4.5;
>     2.2.2.2 /usr/local/www/2.2.2.2;
> }
>
> At the server level (vhost).
>
> server {
>     server_name test1 test2;
>     root $root_dir;
>     #...
> }
>
> --- appa
>
> [1]  http://nginx.org/en/docs/http/ngx_http_geo_module.html
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


-- 


-- Thank you for your time
-- Paul G Webster
-- Checkout Opera M2 @ http://www.opera.com/mail/



More information about the nginx mailing list