Not that I would ever claim my configs are a good tutorial, but I use nginx
as a frontend to some of my django apps running on apache. I included one of
my server configs if it might help, but I don't know of any real tutorials
off hand.

server {
                listen          xxx.xxx.xxx.xxx:80;
                server_name     foo.com;

                access_log      /var/log/nginx/foo.access_log main;
                error_log       /var/log/nginx/foo.error_log info;

                root /home/foo/html;

                # serve static files
                location ~ ^/(js|img|swf|css|pdf)/ {
                        root    /home/foo/media;
                }
                location ~ ^/site_media/ {
                        rewrite ^/site_media/(.*)$      /$1     permanent;
                }
                location /favicon.ico {
                        return 204;
                }
                location /robots.txt {
                        root    /home/foo/html;
                }
                # proxy web app
                location / {
                        proxy_pass      http://127.0.0.1:8085;
                }
        }


On Fri, Apr 9, 2010 at 3:30 PM, MMRUser <[email protected]> wrote:

> Done with static media serving, but most of the people say that it is
> not good to server static media in the same server that Django runs..
> So I want to serve those static media through nginx, do you know any
> good resources tutorials that guide implementation process..
>
> Thanks..
>
> On Apr 9, 4:02 pm, Graham Dumpleton <[email protected]>
> wrote:
> > On 9 April 2010 19:41, MMRUser <[email protected]> wrote:
> >
> > > Thanks I managed to fix the problem, now I need to know how to server
> > > static media on Apache. Before I used Django development server and
> > > made some configurations to serer static media (settings.py and html
> > > files), so I want to know, are those settings need to change or
> > > remove, and the proper way of serving static media. I used the Alias
> > > directory..
> >
> > > Alias /templates/ "sites/testproject"
> >
> > The last argument must be an asbolute path, what you have isn't. There
> > must also be a trailing slash on last argument.
> >
> > > <Directory "sites/testproject">
> >
> > Not an absolute path here either.
> >
> > See examples in:
> >
> >  http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting.
> ..
> >
> > This isn't a mod_wsgi issue per say, so also go look at Apache
> > documentation on Alias directive.
> >
> > BTW, when using Django, the static files are those found under /media
> > URL. Why are you using 'templates'?
> >
> > The Django integration guide at:
> >
> >  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
> >
> > shows the static media serving example as well specific to Django.
> >
> > Graham
> >
> > >    Order allow,deny
> > >    Allow from all
> > > </Directory>
> >
> > > But this didn't go well..
> >
> > > On Apr 9, 1:16 pm, Graham Dumpleton <[email protected]>
> > > wrote:
> > >> On 9 April 2010 17:09, MMRUser <[email protected]> wrote:
> >
> > >> > I'm getting an import error on my server's log
> >
> > >> > raise ImportError, "Could not import settings '%s' (Is it on
> sys.path?
> > >> > Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
> > >> > ImportError: Could not import settings 'myproject.settings' (Is it
> on
> > >> > sys.path? Does it have syntax errors?): No module named
> > >> > myproject.settings
> >
> > >> > but I appended it correctly in my django.wsgi script
> >
> > >> > import os
> > >> > import sys
> >
> > >> > os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
> >
> > >> > sys.path.append('F:/Apache Software Foundation/Apache2.2/sites/
> > >> > myproject')
> > >> > import django.core.handlers.wsgi
> > >> > application = django.core.handlers.wsgi.WSGIHandler()
> >
> > >> > Can't figure out the reason...
> >
> > >> > Python 2.6
> > >> > Apache 2.2
> > >> > mod_wsgi 3.0
> >
> > >> You added the wrong directory, should be the parent directory of the
> > >> site, not the site directory itself.
> >
> > >> This is explained in:
> >
> > >>  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
> >
> > >> But better than that, have a big read of:
> >
> > >>
> http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
> >
> > >> and use the WSGI script described at the end of the latter, it may
> > >> save you a lot of potential problems.
> >
> > >> Graham
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "modwsgi" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> [email protected]<modwsgi%[email protected]>
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<modwsgi%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en.

Reply via email to