I'm using DigitalOcean / Nginx / Laravel, already have wildcard subdomains for each user. ( i.e : user1.mydomain.com )
But I'm having trouble pointing an external domain ( user-domain.com )
to one of the subdomains (user1.mydomain.com ).
I tried adding a CNAME / A on the external domain, but does not seem to be working.
Anyone had experience with this ?
Not clear what you're trying to accomplish:
Have user-domain.com redirect to user1.mydomain.com?
Have user-domain.com and user1.mydomain.com load up the same content/app?
Option 2
The DNS records of both user-domain.com and user1.mydomain.com need to point to your server that's running Nginx, by using "A" records.
Nginx is configured to recognize both domain names in the
server_nameparameter (see http://nginx.org/en/docs/http/server_names.html and https://stackoverflow.com/questions/9454764/nginx-server-name-wildcard-or-catch-all)Not sure about Laravel but in Django you'd have to whitelist each domain in the app settings.
Any urls that include the domain name would have to be generated by your Laravel app using the correct domain of the two.
Thanks! Will test and get back to you.
Look into Openresty, which is built upon nginx.
With it you can automatically generate a LetsEncrypt certificate.
You can do the same with nginx but you can't generate SSL certificate automatically, therefore you need to use Openresty. There are few blog posts explaining how to set it up.
Awesome will check it out.
I was thinking that the user will take care of setting up certificates for his domain but whatb you suggested sounds better.
This comment was deleted 7 years ago