Files from assets directory not loading in production mode

I am trying to setup erpnext on digitalocean droplet. Everything works fine with “bench start”. However when I tried to move to production mode then all files are not loading up. Files from assets directory are not loading up in production mode. Please see this screenshot

Also I found out following lines in nginx.conf
location /assets {
try_files $uri =404;
}

Hello Atif,

I’m assuming you have configured supervisor and nginx for production environment. Pls update the bench to rebuild the asset, css and js.

bench update

Sunil
Nescode(http://nescode.com)
Partner for ERPNext

now updated bench with

bench update

and reloaded supervisor and nginx but still same problem. Any further help?

SOLVED

Made mistake of installing with root user. Installed everything from scratch using a non-root user and now everything is working fine.

regards,
Atif

Please check the HTTP error code, whether it’s 404 or 403…

If it’s 403, as root, run

chmod o+rx /home/frappe

EDIT: Sorry, just saw the screenshot, check nginx error log. If it says permission denied, run the above chmod command, else bench update should build the assets anyway if they don’t exist

2 Likes

sudo setsebool -P httpd_read_user_content 1

if you’re on Fedora

Very very late reply but after a full day of head scratching the final solution was to adjust the permissions on my user directory under home

    chmod 701 /home/<frappe-user>

remember to substitute for your own user

This worked for me on CentOS 7.4

6 Likes

this still work in ubuntu latest version and frappe 14