Inability to access erpnext with Hostname in Multitenant

Dear Friends,Help.
In my test environment i have changed my default site to www.fredoluka.com and add host name www.fredoluka.com.I have also created the second site as www.fredoluka2.com and the host name www.fredoluka2.com.I have added the host name (www.fredoluka.com) to my site_config.json in the site www.fredoluka.com and then bench setup nginx and then restart nginx.Unfortunately the nginx refused to be setup.Icannot access site www.fredoluka,com with www.fredoluka.com.
Pls note that i have enable dns multitenancy.
I cannot access any of the two sites.i set up production in the ubuntu 16.4 in local system and i have been exploring erpnext with access through Local host until i changed to the dns multi tenancy
This is the error from bench setup nginx
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/setup.py”, line 22, in setup_nginx
make_nginx_conf(bench_path=“.”, yes=yes)
File “/home/frappe/.bench/bench/config/nginx.py”, line 13, in make_nginx_conf
sites = prepare_sites(config, bench_path)
File “/home/frappe/.bench/bench/config/nginx.py”, line 61, in prepare_sites
sites_configs = get_sites_with_config(bench_path=bench_path)
File “/home/frappe/.bench/bench/config/nginx.py”, line 151, in get_sites_with_config
site_config = get_site_config(site, bench_path=bench_path)
File “/home/frappe/.bench/bench/config/site_config.py”, line 11, in get_site_config
return json.load(f)
File “/usr/lib/python2.7/json/init.py”, line 291, in load
**kw)
File “/usr/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 367, in decode
raise ValueError(errmsg(“Extra data”, s, end, len(s)))
ValueError: Extra data: line 20 column 2 - line 21 column 1 (char 391 - 421)
Kindly help
Fred

Dear Friends,
Any help?

Do you own both the top level domains?
www.fredoluka.com
www.fredoluka2.com

What multi-tenancy does is help you do the following

www1.fredoluka.com
www2.fredoluka.com

2 sub-domains, 1 domain, 1 host.

Hope that helps.

Looks like the site config json format has errors.
Try using jsonlint.com to validate json.
Thanks

@Deepak_Pai Thanks for quick response.The domain names are created by me to just get access to the erpnext on lan environment and not over the internert.I just want to test the domain method of access the erpnext before moving to the digital ocean to subscribe hosting and then buy the domain name from godaddy.But i got stuck.I could not logged in through www.fredoluka.com nor through the localhost.
I am sorry for bothering you.I just thought on LAN ,something like domain name can also be used to access erpnext if dns multitenency is enable.
Just need a guide to use multitenancy in local evironment if possible

What happens if you ping or trace route the 2 domains on your Lan:

tracert www.fredoluka.com1
tracert www.fredoluka2.com

Does it leave your LAN? if it does, your local DNS needs to be told to resolve these two hostnames to your ip address where the ERPNext is running (locally).

Hope that helps.

@Deepak_Pai
i have installed my ubuntiu in a local computer with the window server 2008 as the second OS,i have not joined the system to any network yet but just get access to my erpnext in the ubuntu when i have not enable the dns multitenency.So without joining any network the multitenancy will not work?Or how can i ping from the same system?Sorry for bothering you.

ok my friend. Either way, when you type in a web URL into your browser, your computer asks the DNS server (which is probably pointing it to an external DNS) what IP it should send packets to. There is a good chance that the DNS you are using either doesnt know where this ERPNext is or giving you an IP address that is not the ERPNext machine.

Thats why try this
tracert www.fredoluka.com1 (or traceroute in unix, google it pls)
tracert www.fredoluka2.com

And see what output it gives. And write back.

Thanks.This is the output of traceroute www.fredoluka.com :traceroute: unknown host

@Fred1

To be able to acces any hostname from your local computer you need to add that domain to your local host/s file on both computers/servers that you will be accessing the ERPNext instances from.

On linux machines you will find your host file @

/etc/hosts

On windows machines @ (usually) and dependent on version please double check

 C:\Windows\System32\Drivers\etc\hosts

The info you enter should be in the format:

127.0.0.1 www.fredoluka.com
127.0.0.1 www.fredoluka2.com

The format applies to both Linux & Windows

Hope this helps

1 Like

sorry friend Saids, where can i find the /etc/hosts file .Any command from the bench to get the direction.I searched i did not see.
FRED

Its not in your bench.
/etc/hosts is on your Linux box.

@Fred1

You access it from your terminal by using this command

1. cd /etc/hosts
2. sudo nano /etc/hosts (nano is a linux text editor)
3. add the hostname/s as per above instructions
4. press ctrl + x
5. press y
6. hit return

You should see something like below when you enter nano text editor

1 Like