середа, 9 квітня 2014 р.

Nginx - setting different root folder for different subdomains

Just found useful way to make nginx config more flexible and create as many subdomains as you need without a need to change vhost configuration.

Here is this sample config:

server {
        server_name ~^(?.+)\.example\.com$;
        root /www/$subdomain.example.com;
.....

Then just create needful folders in /www/.

References:
http://stackoverflow.com/questions/9233368/nginx-server-configuration-subdomain-to-folder

Немає коментарів:

Дописати коментар