In this tutorial I'll show you how to direct your incoming web traffic dynamically to folders on your server. This is really useful for a lot of setups I use this one a lot for development environments because you can give developers rights to create new folders and it automatically has its own sub domain.


DNS endpoint Folder on disk /var/www/ /var/www/ /var/www/

Nginx config

Place this in your server block and remove the current server_name

server_name     "~^(?<subdomain>.+)$";
root            /var/www/$subdomain/htdocs;

That's all, if you have questions or suggestions, post them bellow.

- Stein van Broekhoven


comments powered by Disqus