ahh

my blessed governor came and helped me out

server {
        listen 80;
        index index.html;
        root   /path/to/djangoproject/top/folder;
                        location ~*
^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
                        {
                                root
path/to/folder/that/contains/files/in/static/folders/;  (minus the folder
name media that was on the end)
                                expires 30d;
                                break;
                        }

Big up to kwe

On 15/01/2008, Matt Davies <[EMAIL PROTECTED]> wrote:
>
> Hello everyone
>
> Has anyone had any experience of serving up static content with nginx?
>
> Here's the relevant parts from my setings file
>
> MEDIA_ROOT = '/path/to/folder/that/contains/files/in/static/folders/'
>
> so that last folder has folders called images, and css etc etc.
>
> MEDIA_URL = 'http://webisteurl/media/
>
> Now this works fine using lighttpd and a rewrite rule in lighttpd.conf
>
>    alias.url = (
> #                 "/media/" =>
> "/path/to/folder/that/contains/files/in/static/folders/",
> #   )
> #   url.rewrite-once = (
> #          "^(/media.*)$" => "$1",
> #     "^(/.*)$" => "/mysite.fcgi$1",
> #   )
> #  }
>
> But I'm buggered if I know how to write that in the nginx.conf file.
>
> I've tried alot of different variations on this theme
>
> server {
>         listen 80;
>         server_name websiteurl;
>         index index.html;
>         root   /oath/to/djangoproject/top/folder;
>         location    /media/    {
>                 root
> /path/to/folder/that/contains/files/in/static/folders/;
>         }
>         # static resources
>         location ~*
> ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
>         {
>                 expires 30d;
>                 break;
>         }
>
>
> If anyone can shed any light I would be eternally grateful, it's starting
> to annoy me now.
>
> :-)
>
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to