Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

How can I work with several sub-domains in NGINX?

$
0
0
I understand to a certain degree how the regex expressions work for nginx and server_name, but there's one regex that I just cannot get my head around.

I want to have several sub-domains in the form of:

app.example.com

a.app.example.com

b.app.example.com

My regex is: ~^(?<app>.+)\.example\.com$

My root directory points to: /path/to/nginx/html/example_app/$app

The logical values of $app should be 'app', 'a.app' and 'b.app'

However, the corresponding directories are not found.

I've tried having directories called: 'app','app.example' and 'app.example.com' for app.example.com

And 'a','a.app','a.app.example' and 'a.app.example.com' for a.app.example.com' and still errors.

Can anyone assist? Thanks in advance!

Viewing all articles
Browse latest Browse all 4759

Trending Articles