How to setup sub-domain with nginx based on Angular app uri

September 19, 2017 1.5k views
Nginx Ubuntu 16.04

This is my url:{partner_name}/orders/list

I would like to setup subdomain for every {partner_name} via Nginx.

For example, instead of: I want something like this:

Thank you!

1 Answer


What I would suggest is creating server blocks for each subdomain name, that way you would have full control over how the content is being loaded.

For more information on how to setup server blocks I would recommend going through this guide here:


by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu...
Have another answer? Share your knowledge.