Nginx Map Directive for multiple variables

Alex Block asked:

I currently use nginx with Magento and I use the map directive to supply the store code like this:

map $http_host $magecode { retail_store; wholesale_store; retail_beta_view;

The drawback to this is if I make the beta site its own store, I can’t use the same catalog. Instead, I want to make the beta site a website instead of store.

Is it possible to map two variables at a time? I am imagining it would look like this:

map $http_host $magecode $magetype { retail_store website; wholesale_store website; retail_beta_view store;

If not can I map the same variable twice?

map $http_host $magecode { ... }
map $http_host $magetype { ... }

My answer:

Yes, you can use more than one map and that seems to be the cleanest way to solve this.

map $http_host $magecode { retail_store; wholesale_store; retail_beta_view;

map $http_host $magetype { website; website; store;

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.