Forum: NGINX How to... - nginx config to serve static files

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Nginx Forum (Guest)
on 2009-03-14 12:07
(Received via mailing list)
From "nginx config to serve static files" at


---Quote (Originally by jpartogi)---
Hi guys.

Thanks for replying. I'm almost there now. Now I can access the
directory, but when I access the file I get 404 again, while the file
already exists on that directory. Is there anything I need to setup?

Thanks in advance
---End Quote---
Okay done with it. :-) Instead of using the about configuration, I just
use wildcards for every static files as stated in the docs as such:

# serve static files
    location ~ ^/(images|javascript|js|css|flash|media|static)/  {
      root    /var/www/virtual/;
      expires 30d;


Posted by jpartogi
This topic is locked and can not be replied to.