Multiple Sites with HTTPS and port forwarding

Here is the scenario -

  1. I have 5 sites running on the same server.
  2. All the sites have the same domain but different sub-domain like abc.dexciss.com, xyz.dexciss.com, etc.

My question -

  1. How do I setup 80 redirection on all the sites with different sub-domains, so I do not have port number trailing the site? Currently I have abs.dexciss.com:81, xyz.dexciss.com:82, etc.
2 Likes

run sudo bench config dns_multitenant on

but ensure that the sub domains are all pointing to the instance IP.

and then run sudo bench setup lets-encrypt abs.dexciss.com

repeat same for all sites

2 Likes

If you have access to your cpanel, under: Zone Editor->manage->A, create your subdomains all pointing to the same ip address.

Go to your computer where erpnext is installed. and setup DNS based multitenancy (Setup Multitenancy)

  • bench config dns_multitenant on
  • bench setup nginx

Then setup https using let’s encrypt, as below
Site name and port: site1.local http://yourerpnextserverip:80/8001/8002

bench setup add-domain subdomain.yourdomain.com
sudo -H bench setup lets-encrypt site1.local --custom-domain subdomain.yourdomain.com

1 Like

I foolowed this but now, only one site runs, all the other sites are down. What do it do?

I followed this too but maybe I am missing something. I also want to tell you that there is another service that is listening to port 80 which is Odoo. Is that an issue. Because now all my sites are down… Pls help

I’m not sure you can change ports after installing, try the below.

bench config dns_multitenant off

bench set-nginx-port site2name 8000

bench set-nginx-port site3name 8001 and so on

bench setup nginx

Were the sites running before on port 80?

You need to confirm the ports for each service/site, and see which are conflicting.

Only one of the sites were running on port 80 and other had trailing port number.

Doing this has started some sites but not all. I will see what I can do to restore them.

That’s Ok.

To add, you have to reload nginx after setup.

Worked like a chart. Thank you

2 Likes

Is it necessary to setup lets-encrypt ? What is the reason.

I am experimenting with ErpNext and when i setup multiple tenants, it doesnt work.
If I set current site in currensite.txt then only that particular site will work.
I havent setup ssl because I dint need it at this point of time.

Is this step absolutely necessary or is optional ?

Setting up SSL helps secure your site traffic if you open up your site to internet access.

If you are running on multi-tenant mode then you do not need to set any site in currentsite.txt as bench config dns_multitenant on will set up nginx to listen to the web address that is being queried and redirect to the correct site. For this to also work, you need to ensure that the site name corresponds to the domain name pointing to it or use the command bench add-domain to add the domain to the site. These configs help ensure Nginx is able to direct queries properly.

You can also search in this forum how to setup multitenant instances. There a multiple threads in the forum that give clear guides on how do achieve this.