Dynamically set current domain in nginx with perl module

Posted by Simone Margaritelli on Server Fault See other posts from Server Fault or by Simone Margaritelli
Published on 2012-09-14T10:47:24Z Indexed on 2012/09/15 15:39 UTC
Read the original article Hit count: 432

Filed under:
|
|

i know how to set variables and use subroutines with the nginx builtin perl module INSIDE a "server" directive but, what i need to do is to set/rewrite the current domain before ...

let's say, we have a domain like

 admin.foobar.website.com

i want that a request to

 foobar.othersite.com

points to the first address ( obviously website.com and othersite.com are hosted on the same webserver running nginx :) ).

For reasons i can't explain here, i can not use multiple server_name directive expressions, i have to do this before the server {} block, with perl or anyway possible.

Thanks

© Server Fault or respective owner

Related posts about nginx

Related posts about webserver