I'm working with an environment for testing purposes based on a few magento versions over a nginx + php-fpm + mysql stack, i puts each distribution in a different folders and in the nginx vhost config file i'm using the following sentence:
server_name ~^(?<version>.+)\.magento\.test$; root [root_path]/distro/$version;
So until here i can get any dinamic url mapped to its folder
ce107.magento.test => [root_path]/distro/ce107/ ce108.magento.test => [root_path]/distro/ce108/ ce109.magento.test => [root_path]/distro/ce109/
The problem starts when i try to use the "host name label" to switch websites on each distribution:
us.ce107.magento.test, ar.ce107.magento.test ...
because nginx looks for: [root_path]/distro/us.ce107/ and [root_path]/distro/ar.ce107/ folders.
So i need to parse and retrieve the values of:
[ws_code].[version].magento.test
and i can't figure out how to do it, maybe i could use "map $host $ws_code {}" to parse $ws_code value, and apply some regex to remove "ws_code." part from the $version
BTW obviously i can do it "harcoded" but i want to keep it "dinamic"
Can someone give a hand with this? Thanks in advance!