I am unable to get the subdomain from the URL in NGINX
- by Jean-Nicolas Boulay Desjardins
I am unable to get the subdomain from the URL in NGINX.
Here is my config:
server {
listen 80;
server_name ~^(?<appname>)\.example\.com$;
rewrite ^ https://$appname.example.com$request_uri? permanent;
}
When I do:
http://bob.example.com/
I am sent to:
https://.example.com/
I don't know what I am doing wrong.
I am using NGiNX 1.2.7.
I have another config for the:
http://example.com/
So I have one server block for the domain without the subdomain and the second with the subdomain... This is about the subdomain.