Unable to access ERPNext production server - Locally hosted on VM

Hello,

I am running Mac OS Ventura 13.4, and have Parallels Virtual Machine (VM) running Ubuntu 22.04. VM is running in bridge network mode, so it gets assigned its own internal network IP which is different than Mac OS IP.

I installed ERPNext on the virtual machine, and when i use the command “bench start” I can access the development server using the VM Local network IP address, from within Ubuntu VM and from my Mac OS browsers.

I then followed this https://codewithkarani.com/2021/09/16/setup-erpnext-for-production/, to setup production server.

The production server is running based on nginx status, on port 80, but I am unable to access the production server using the same ip address neither from within Ubunt VM not Mac OS.

Here is the output of netstat -plnt
ctive Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1464/sshd: /usr/sbi
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1075/cupsd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 11208/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 858/systemd-resolve
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1187/mariadbd
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 1081/redis-server 1
tcp6 0 0 ::1:6379 :::* LISTEN 1081/redis-server 1
tcp6 0 0 :::22 :::* LISTEN 1464/sshd: /usr/sbi
tcp6 0 0 :::80 :::* LISTEN 11208/nginx: master
tcp6 0 0 ::1:631 :::* LISTEN 1075/cupsd

This is the output of “bench setup nginx” which shows the site is running on port 80.

bench setup nginx
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site frappesiteurl.com assigned port: 80

I am also able to ping the VM from Mac OS, as well as SSH into Ubuntu VM from Mac os.

This is the /etc/hosts file on my Ubuntu VM running on Parallels
127.0.0.1 localhost
127.0.1.1 ubuntu-linux-22-04-02-desktop

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

And this is the /etc/hosts output of Mac OS

Host Database

localhost is used to configure the loopback interface

when the system is booting. Do not change this entry.

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

Currentsite.txt has my site name in it.

If I run “bench start” the development server runs perfectly, but unable to access production server.

I am new to this self-hosting process, so I apologize for any information which I may have skipped. I would really appreciate if you can please help me on this.

Once I get past this issue and am able to access my locally hosted production server from VM, then I will try to work out a way to access the production server through internet using custom domain, through DNS, but if any of the gurus here know a way would also appreciate some information on that.

What happens if you try localhost:8000?

What happens if you do bench use myfrappesiteurl.com and then bench start ?

Thank you oguruma for replying.

Trying Localhost:8000 results in Not Found message.

bench start works fine, as it fires up the development server and I can access it perfectly fine.

The problem is when I use the command “sudo /home/erpnext/.local/bin/bench setup production erpnext” to start the production server, the server starts fine but cannot access it.

The output I get from above command is as follows:

Site frappesiteurl assigned port: 80
Setting Up symlinks and reloading services…
$ /usr/bin/supervisorctl reread
No config updates to processes
$ /usr/bin/supervisorctl update
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

I have tried localhost:8000, locahost:80, 192.168.86.38:8000, 192.168.86.38:80, tried with the ip of Parallels VM as well but same result.

After bench start, i am able to access development server.

Sorry forgot to mention, bench use blackwell.com results in the following output: Current Site set to blackwell.com, but even after this I cannot access production server.

For some reason my messages being ignored. But using localhost:8000 results in Not Found error when running production server

I have not used parallels VM, but on VirtualBox…setting the VM using NAT causes similar problems…perhaps the network setup you have chosen has an inherent firewall or block from outside traffic.

It seems your production mode has not started… perhaps check if the ports are active using netstat or ss

Hello trentmu,

Thank you for responding. I tried to put my VM in shared networking mode, where it used my Mac OS network instead of Bridged mode, but still the same issue persists.

The output of netstat and ss are too long to put here. Any suggestions what I should be looking for?

Immediately after I executed netstat and ss, I also executed command sudo service nginx status and it shows that it is active and running (please see output below).

`erpnext@ubuntu-linux-22-04-02-desktop:~$ sudo service nginx status
[sudo] password for erpnext:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-03-07 10:36:51 EST; 1min 52s ago
Docs: man:nginx(8)
Process: 1082 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1108 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1110 (nginx)
Tasks: 3 (limit: 2185)
Memory: 7.2M
CPU: 17ms
CGroup: /system.slice/nginx.service
├─1110 “nginx: master process /usr/sbin/nginx -g daemon on; master_process on;”
├─1111 “nginx: worker process” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “”
└─1112 “nginx: worker process” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “” “”

Mar 07 10:36:51 ubuntu-linux-22-04-02-desktop systemd[1]: Starting A high performance web server and a reverse proxy server…
Mar 07 10:36:51 ubuntu-linux-22-04-02-desktop systemd[1]: Started A high performance web server and a reverse proxy server.
erpnext@ubuntu-linux-22-04-02-desktop:~$ ^C
erpnext@ubuntu-linux-22-04-02-desktop:~$ `

Hello trentmu,

Interesting to your point that my production server may not be running, I assumed that when I setup production server, and setup nginx, it would automatically be listening on port 80.

But when I executed command netstat -tulpn to check the ports that are currently listening in Ubuntu, interestingly it doesn’t show any program name in the column “PID/Program Name” for line corresponding to port 80 (see output below). Shouldn’t nginx be listening to this port?

Could this be the issue?

On my Ubuntu 22.04.4 LTS I get the following when I run netstat -tulpn:

xgtfrappe@xgterpnext:~$ netstat -tulpn
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:11000         0.0.0.0:*               LISTEN      52157/redis-server
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:8000          0.0.0.0:*               LISTEN      52158/python
tcp        0      0 127.0.0.1:13000         0.0.0.0:*               LISTEN      52156/redis-server
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp6       0      0 ::1:6379                :::*                    LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
udp        0      0 127.0.0.53:53           0.0.0.0:*                           -
udp        0      0 192.168.7.22:68         0.0.0.0:*                           -
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -
udp        0      0 0.0.0.0:43152           0.0.0.0:*                           -
udp6       0      0 :::49267                :::*                                -
udp6       0      0 :::5353                 :::*                                -

So nginx doesn’t have to show up as the program listening.

Have you tried a curl 127.0.0.0 on the VM’s terminal? I do get the login page back.

Thank you matthkarl for responding.

`erpnext@ubuntu-linux-22-04-02-desktop:~/frappe-bench$ curl 127.0.0.0
<!doctype html>

404 Not Found

Not Found

blackwell.com does not exist

`

I read somewhere I had to add 127.0.0.0 blackwell.com line to /etc/hosts file, and I tried doing that as well, but it still gives the same error.

Hello,

So I was tried to start development server using command bench start and the development server works correctly.

Then I tried to restart production server using command sudo bench setup production erpnext and that also seems to execute correctly, below is the output of this command:

`erpnext@ubuntu-linux-22-04-02-desktop:~/frappe-bench$ sudo bench setup production erpnext
Setting Up prerequisites…
Setting Up supervisor…
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Setting Up NGINX…
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
Port configuration list:

Site blackwell.com assigned port: 80
Setting Up symlinks and reloading services…
$ /usr/bin/supervisorctl reread
No config updates to processes
$ /usr/bin/supervisorctl update
$ sudo /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx`

Then I tried to ping blackwell.com and I get an error : ping: blackwell.com: Temporary failure in name resolution

I then pinged 127.0.0.0 and i get successful ping:
PING 127.0.0.0 (127.0.0.0) 56(84) bytes of data.
64 bytes from 127.0.0.0: icmp_seq=1 ttl=64 time=0.062 ms
64 bytes from 127.0.0.0: icmp_seq=2 ttl=64 time=0.155 ms
64 bytes from 127.0.0.0: icmp_seq=3 ttl=64 time=0.088 ms

So, next I tried to open 127.0.0.0 in browser, and instead of getting “Not Found” error, I got this new error:

This is at least one step ahead of where I was stuck, I am not sure what I did that got this screen, but considering that it shows some error related to the system, I am taking this as a positive sign.

Lastly, I put the VM back in Bridged mode, and then tried to access the ERPNext system through local network ip and got the same “Sorry! We will be back soon” error.

Would really appreciate some guidance on this, as to how can I access my production server on my Parallels Ubuntu VM, running on Mac OS.

Hello Gurus,

Can you please help me resolve this issue? Anyone any suggestions?

Well with regards to blackwell.com, what does that actually resolve to on your local system? If you own the domain, it’s going to resolve to whatever the default for your registrar/web host is set to, which is NOT going to be your local machine…

Tht url isn’t going to resolve to your local machine/VM unless you override that in local DNS somehow.

Run bench restart Do you see any errors?

Hello oguruma,

This is not live site (with a domain) that I am trying to access it from internet. That part I am yet to figure out. blackwell.com is just the name of my local site, it is not a domain I own.

This is a local production server running on my Ubuntu virtual machine (which is running on my mac os), and I am trying to access production server from the Ubuntu virtual machine itself.

Everything is local on my virtual machine.

Here is the output of bench restart. I don’t get any error.

Any clue, as to why if I run bench start, I can access my development server just fine, but not my production server, in spite of nginx running?

Also, I am not sure how to check what my site resolves to on my local system. Could you please help me how to find that?

Hi,

Try: dig blackwell.com and man hosts .

Thank you. My site is unreachable on my my local virtual machine. It says communications error.

This is the output of dig blackwell.com

1erpnext@ubuntu-linux-22-04-02-desktop:~/frappe-bench$ dig blackwell.com
;; communications error to 127.0.0.53#53: timed out
;; communications error to 127.0.0.53#53: timed out
;; communications error to 127.0.0.53#53: timed out

; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> blackwell.com
;; global options: +cmd
;; no servers could be reached`

I am currently unminimizing manpages, as the man hosts command did not work.

Will post the output as soon as I can.

Hello guys,

I am sorry to keep asking, but I am really stuck. Any thoughts on where I can look or what fix I can pursue to resolve this issue?