HI, i am using nginx to serve content from from subdomains, dynamically created as directories.
I have two folders in my web path: "public" (where my main site's files are located) and "subdomains".
The "subdomains" directory contains directories which are accessed via the subdomains.
e.g. subdomains/test/index.html is accessed when opening http://test.domain.com/index.html
Here is the relevant part of my conf file.
server {
...
set $myroot /home/user/web/public;
set $subdomains /home/user/web/subdomains;
if ($host ~* (.*)\.domain\.com$) { set $myroot $subdomains/$1; }
root $myroot;
location / { .... }
....
}
My question is this: Is this configuration dangereous because of the "if" use or is it safe?
I read all sorts of articles saying alot of different things. Some of them say that the "if" statement is bad only in a "location" context, others say it's always bad. I am really confused.
Please share your oppinions. Thanks !