Francis Daly
July 22, 2020 06:54AM
On Tue, Jul 21, 2020 at 11:41:31PM -0700, Kunal Punjabi wrote:

Hi there,

> I've been struggling with setting up nginx subdomains on my linode instance
> and setting up CNAME redirects.

I don't fully understand what you are trying to do here.

For example -- what do you mean by a CNAME redirect?

> *What I need is to be able to do:*
> 1. First set up wildcard subdomains on my server (, so that
> users can go to,, etc.

server_name *;


Or, if the names should be handled differently:

server { server_name; }
server { server_name; }

> My server is running nuxt.js on port 4001 (default port is 3000 but I chose
> to use 4001 as a non-standard port), so I guess I have to use reverse
> proxies:
> proxy_pass http://localhost:4001;

Ok. Does your nuxt.js service care whether the original request was for
the hostname abc or xyz? If so, you may want to indicate to it what the
original hostname was.

> 2. Then for my users I need to set up CNAME redirects from to
>, and from to, so that if
> I visit , it would serve the contents (without redirecting me)
> of

I don't know what you mean by that.

Might it be

server { server_name; }

or perhaps

server { server_name;
location / { proxy_pass; }


> However, I've not been able to get step 1 working. Can someone who is
> experienced with nginx setup please guide me?

Can you give some specific examples of "I make *this* request, and I
want to get *this* response"?

It looks like you have a nuxt.js http service listening on port 4001, and
you want an nginx https service to listen on port 443 and reverse-proxy
the 4001 service.

But your suggested nginx config seems to try to do something different
from that.

Good luck with it,

Francis Daly
nginx mailing list
Subject Author Posted

Wildcard subdomains in Nginx

Kunal Punjabi July 22, 2020 02:42AM

Re: Wildcard subdomains in Nginx

Francis Daly July 22, 2020 06:54AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready