If: ADMIN_MEDIA_PREFIX = '/media/'
means that static media URLs will all be prefixed with that, then wouldn't: root /home/user/public_html/mysite/public/media; need to be: root /home/user/public_html/mysite/public; This is because you have location '/' on nginx mapped to this directory. Graham On Nov 20, 10:45 am, "Serdar T." <[EMAIL PROTECTED]> wrote: > Hello folks, > Can anyone out there offer advice on glitches in my production > environment, as well as explain the relevant settings.py in plain > English for a newbie? > > I've been pulling my hair out for weeks trying to get an nginx reverse > proxy to serve static media while apache mod_wsgi serves up dynamic > django content. The dynamic content is being served, and I can access > the index of media files in a browser by visiting the MEDIA_URL. > > But for some reason, media does not get served when I access the admin > backend. I get the login screen without any of the stylesheets, > javascript, etc. (and a 500 error when I try to login). > > I haven't had any luck despite countless tweaks to MEDIA_ROOT, > MEDIA_URL, and ADMIN_MEDIA_PREFIX (along with corresponding changes > to nginx and apache config files). > > At the bottom of the post are my various config files. I was hoping > someone could point out whatever dumb mistake I'm making. > Additionally, if someone could explain the concepts behind the > settings.py file and how they relate back to the server config files > -- that would be enormously helpful (the django docs and countless > threads I've read on the subject don't connect the dots clearly enough > -- at least for me). > > I'm hoping a basic explanation might let me penetrate the problem > conceptually, so I'm not just futzing around with tweaks with no idea > what's really happening. > > Can someone teach a man to fish? > > ****************settings.py**************** > MEDIA_ROOT = '/home/user/public_html/mysite/public/media/' > MEDIA_URL = 'http://media.mysite.org/' > ADMIN_MEDIA_PREFIX = '/media/' > > ******************/etc/nginx/nginx.conf************* > user www-data; > worker_processes 3; > > error_log /var/log/nginx/error.log; > pid /var/run/nginx.pid; > > events { > worker_connections 1024; > > } > > http { > include /etc/nginx/mime.types; > default_type application/octet-stream; > > access_log /var/log/nginx/access.log; > > sendfile on; > #tcp_nopush on; > > #keepalive_timeout 0; > keepalive_timeout 10; > tcp_nodelay on; > > gzip on; > > upstream webcluster { > server 127.0.0.1:8080; > } > > include /etc/nginx/sites-enabled/*; > > } > > *****************/etc/nginx/sites-available/mysite.org************* > server { > listen 80; > server_name media.mysite.org; > access_log /var/log/nginx/mysite.media.access.log; > location / { > autoindex on; > index index.html; > root /home/user/public_html/mysite/public/media; > > } > > } > > server { > listen 80; > server_name mysite.orgwww.mysite.org; > access_log /var/log/nginx/mysite.django.access.log; > if ($host !~* "^mysite\.org") { > rewrite ^(.*)$http://mysite.org$1permanent; > break; > } > location / { > proxy_passhttp://webcluster; > include /etc/nginx/proxy.conf; > } > > } > > *****************/etc/apache2/sites-available/mysite.org************** > <VirtualHost 127.0.0.1:8080> > ServerAdmin [EMAIL PROTECTED] > ServerNamewww.mysite.org > ServerAlias mysite.org > WSGIScriptAlias / /home/user/public_html/mysite/test_app/ > mysite.wsgi > > <Directory /home/user/public_html/mysite/test_app> > Order deny,allow > Allow from all > </Directory> > > LogLevel debug > ErrorLog /var/log/apache2/mysite/error.log > CustomLog /var/log/apache2/mysite/access.log combined > > </VirtualHost> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---