Hi , I followed this video to install ERPNext in Ubuntu 22.04 and it works well in development mode, meaning that I can access it with IP address.
But when I tried setting the production mode, It didn’t load CSS or Javascript files for the login page. it only displayed as HTML like this.
I used these steps to setup production.
bench config dns_multitenant on
sudo bench setup production erpnext # the user on server
bench restart
sudo bench setup lets-encrypt example.com
bench restart
I also restarted the server, but it’s not fixed!
I tried bench update
, bench migrate
, bench build
and bench restart
. Still no fix.
I looked into /var/nginx/error.log
and found lots of permission denied errors.
2022/07/01 12:59:14 [error] 21435#21435: *17265 open() "/home/erpnext/frappe-bench/sites/assets/frappe/dist/js/frappe-web.bundle.KUUQCGRY.js" failed (13: Permission denied), client: X.X.X.X server: example.com, request: "GET /assets/frappe/dist/js/frappe-web.bundle.KUUQCGRY.js HTTP/1.1", host: "example.com", referrer: "https://example.com/"
2022/07/01 12:59:14 [error] 21435#21435: *17261 open() "/home/erpnext/frappe-bench/sites/assets/erpnext/dist/js/erpnext-web.bundle.V77BG4KN.js" failed (13: Permission denied), client: X.X.X.X, server: example.com , request: "GET /assets/erpnext/dist/js/erpnext-web.bundle.V77BG4KN.js HTTP/1.1", host: "example.com", referrer: "https://example.com/" 2022/07/01 12:59:14 [crit] 21435#21435: *17267 open() "/home/erpnext/frappe-bench/sites/example.com/public//website_script.js" failed (13: Permission denied), client: X.X.X.X, server: example.com, request: "GET /website_script.js HTTP/1.1", host: "example.com"
I noticed there’s no dist/
directory, inside sites/assets/erpnext/
, so I made a symbolic link from /home/erpnext/frappe-bench/apps/erpnext/erpnext/public/dist/
to /home/erpnext/frappe-bench/sites/assets/erpnext/dist/
and verified the required file exists!
$ ls -lah /home/erpnext/frappe-bench/sites/assets/erpnext/dist/js/erpnext-web.bundle.V77BG4KN.js
-rw-r--r-- 1 erpnext erpnext 33K Jun 30 22:32 /home/erpnext/frappe-bench/sites/assets/erpnext/dist/js/erpnext-web.bundle.V77BG4KN.js
But still, the permission denied issue exists!!
It worth noting that when I visit that file from the browser /assets/erpnext/dist/js/erpnext-web.bundle.V77BG4KN.js
I get 403!
Any help please?