Multitenant causes site to crash

okay I got it. so now, I’ve created an A record with the test.mydomain.in
now, the new site is working but the original site is not. the original site is showing the “sorry we’ll be back soon” error.
I also created another site, demo.mydomain, which is also working.

  1. Every time I faced this error was because of nginx configuration i.e. /etc/nginx/sites-available/ OR site_config.json entries OR if I tried to play with frappe-bench.json.
  2. If your new sites are accessible that means your DNS based multi-tenant is working fine with sub-domains, assuming your main domain is still configured with an A entry accordingly.
  3. Resulting from nginx reload points to the configuration / entries related to point 1.

/etc/nginx/sites-available has a file named default with the following contents

server {
	listen 80 default_server;
	listen [::]:80 default_server;
	
	root /var/www/html;

	index index.html index.htm index.nginx-debian.html;

	server_name _;

	location / {
		try_files $uri $uri/ =404;
	}
}

site_config.json for the original site shows this

{
 "db_password": "db_password", 
 "db_name": "db_name", 
 "host_name": "mydomain"
}

I don’t know where to look for frappe-bench.json

another question:

  1. the original site folder is named site1.local, should I rename it?
  2. if I dropped the site site1.local (please tell if there is any other step/command except bench drop site and created new site using bench new-site mydomain (without subdomain) can it solve my problem?

Indeed site1.local won’t work with domain that needs to be domain.tld (e.g. domain.com).
If you don’t have any issue just create new one and it solves the problem.
If you wish to rename it yes you can do that just rename the folder and change /config/nginx.conf to replace site1.local with your domain.tld.
Better to stop server: sudo service nginx stop and after renaming the folder and editing conf: sudo service nginx start.

thanks @JayRam and @Faraz for all your help.
I created a new site with base domain and everything is working fine now. Haven’t dropped the site1.local site yet. I hope it doesn’t cause problems.
erpnext is amazing and very powerful and its wonderful to be a part of the community.

Well, you did all the work. We just helped you find you the answers.

I’m curious as to why your site1.local is not working.

So, let’s say you have three domains a.mycompany.com, b.mycompany.com and c.mycompany.com.

When you ping each of these, what results do you get?

Have you forwarded these domains with masking or without masking?

Just see the difference in these pings between a, b & c and the way you have forwarded those domains on your domain manager.

The answer should be in what you see.

Welcome to ERPNext and we are sure glad you are here.

Thanks

Jay

1 Like

Sorry I don’t know much but this is what I’ve understood

I did ping test on the original domain and the subdomains, all seem to be working fine. even the ip address is working fine. By fine I mean, it shows data package transmitted and received and no packet loss, no error.
I don’t see any difference in the pings.

about forwarding with or without masking, i just created an A record in google cloud dns with the site name I created using bench new-site and pointed it to external IP address of the vm instance (as suggested by you)

as said in previous post, I created a new site with bench new-site mydomain.com which had solved the problem. maybe its because I didn’t rename the site1.local folder name to mydomain.com. what do you think? I still have the site1.local

I tried renaming site1.local folder to test2.mydomain using mv command
test2.mydomain said server not found
ping says unknown host

Hi, there’s a new problem. mydomain.com is working but www.mydomain.com is not. I’ve already added a cname record (dns name: www.mydomain.com canonical name: mydomain.com {@ was working earlier but now its not})

I tried:

bench --site mydomain.com setup add-domain www.mydomain.com

but it says no such command setup

how do i fix www.mydomain?

Thanks for all help.