Unable to access Frappe 14 site on Local Network (VirtualBox)

@vimalraj

Watch this video

ERPNext Error After Install - 127.0.0.1 does not exist

I hope this works

Thank You!

I tried the method shown in this video already. It did not work.

I created a new site called “test” using:
bench new-site test

Then I added it to “/etc/hosts” file using:
bench --site test add-to-hosts

Then I added it to “currentsite.txt” using:
bench use test

Then I setup and reload Nginx and Supervisor using the following:

bench setup nginx
bench setup supervisor
sudo service nginx reload
sudo service supervisor restart

Then I restarted the bench using:
bench restart

Then I rebooted the whole Server(VM) using:
sudo reboot

It still did not work. The site is still showing 404.

If I understand the mechanism correctly:

if you use
bench --site test add-to-hosts
then you should access the site with the URL
http://test:8000

(or whatever port your webserver is on)
This assumes that you’re using the browser on the same machine where your erpnext instance is running.

If I got it correctly, ERPNext seems to use virtual hosts in order to differentiate between sites, so the sitename must be provided by the browser (which is the normal procedure), but if the name of the site is not available via DNS (for instance if you have the erpnext instance on a machine in the internet WITH exactly that site name as DNS name), then the machine you browse with to your test site must use the site name as domain name (in the http:// expression) AND use the IP of your test instance. If you use another machine to browse your test instance, you should make sure that the /etc/hosts file of your broswer machine contains the IP address of your erpnext instance where the site is running. Which could be another IP on your LAN, or the IP of your virtual box host. So these things depend somewhat on your local/LAN setup. On windows the hosts file has another path, but can also be used as such a DNS shortcut.

You mean replace the default ip 127.0.0.1 with ip of the Virtual box ( Something like: 192.168.1.36 ). This is how the “/etc/hosts” file look like in my Virtual box can you say what change should be done to make it work:
image

Yes. But:

What is the IP of the machine with the browser?
Is it Linux, Windows, OpenBSD, mac, …?

You should change the /etc/hosts NOT in the virtualhost machine, but the hosts file of the machine you use to browse to the erpnext instance.

1 Like

I think is 192.168.1.36 (based on previous screenshares)

In your HOST PC hosts file, add

192.168.1.36 workdone

In recent windows os, hosts file is here C:\Windows\System32\drivers\etc\hosts
(open with save permissions …)

Try now acces to workdone from the browser on your HOST PC …

Should I add the IP and site name in both host and client? In that case how to add it in windows file? Should I just add it at the end without “#”?

Add it in client PC.
Don’t use # (is used for comments) . Just add a line

192.168.1.36 workdone

And save it.

It should be:
192.168.1.36 test

(e.g. the name of the site which you created with bench and which is active)

You can add several site names with the same IP to your windows hosts file. That’s not a problem.

I added ‘192.168.1.38 workdone’ (IP changed to 38) in the last line of hosts file in windows and added the same in ‘/etc/hosts’ in linux. Still not working.

And then you opened the URL http://workdone:8000 in your windows browser?

And does the ERPNext instance in your virtualbox have a site “workdone” (created with bench)?
Or does it have a different name?

Yes there is a site called workdone. The current site is set to ‘workdone’. When I try to access site using workdone:8002:

And if you try:

?

Same:

Ping to workdone from client pc?

image

Try http://workdone:8000

No ping, in the browser