question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nginx assets location

See original GitHub issue

in the docker-compose.yml there is this entry:

 erpnext-nginx:
   image: frappe/erpnext-nginx:${ERPNEXT_VERSION}
   ... rest
   volumes:
     - sites-vol:/var/www/html/sites:rw
     - assets-vol:/assets:rw

is there a particular reason why - assets-vol:/assets:rw is not pointing to - assets-vol:/var/www/html/assets:rw.

from what i can observe both /assets and /var/www/html/assets contains the same files, the only difference is that /assets is declared as a volume in the Dockerfile for nginx.

reason i am asking is because if i add a file inside the nginx container under /var/www/html/assets/hello-world.js , then i can access it via http://mysite/assets/hello-world.js.

yet, if i add the file under /assets/hello-world.js, then it doesn’t get served via http://mysite/assets/hello-world.js.

i presume that is because of this nginx config:

server {
    listen 80;
    server_name $http_host;
    root /var/www/html;

    location /assets {
        try_files $uri =404;
    }
}

just not sure what the point is of having /assets as a volume if it isn’t going to get served by nginx

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
revantcommented, Nov 5, 2021

is there any reason why the nginx conf shouldn’t be updated to this?

to ensure assets are always served from container/origin, instead of cache

1reaction
revantcommented, Nov 2, 2021

worker image needs assets at location /home/frappe/frappe-bench/sites/assets

on entry point of nginx image, all assets from nginx image are copied to common volume.

https://github.com/frappe/frappe_docker/blob/33ec8cafc381af2725f21b3f7c0cbb1cd504e904/build/frappe-nginx/docker-entrypoint.sh#L7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serving Static Content | NGINX Plus
Configure NGINX and NGINX Plus to serve static content, with type-specific root directories, checks for file existence, and performance optimizations.
Read more >
Serving Static Assets via Nginx - gists · GitHub
Static assets are located at /var/www/example.com/current/static/ directory. You have registered at a registrar a domain name which could be resolved to the DNS ......
Read more >
Nginx -- static file serving confusion with root & alias
The alias just lets you define a new path to represent an existing "real" path. The location part is that new path, and...
Read more >
NGINX Allow access to static assets and index.php
We also have a directory called assets which contains static css/images/js etc. inside the document root. How can we allow access to only...
Read more >
Nginx multiple locations + static files - DigitalOcean
Hello, I am trying to create the following setup with nginx: subdomain.test.com subdomain.test.com/admin I want nginx to serve static files ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found