Linux‎ > ‎

Nginx Django (Gentoo)

This is a (somewhat cursory) description of the process of getting Django working with Nginx in Gentoo Linux. 
I'm starting with an already functional (but fairly minimal) Nginx installation, so I'll skip configuring that here, except where it's relevant.

This model consolidates configuration to 'sites.list', explicitly maps site names to ports. 
It uses nginx's map syntax, so nginx handles it natively, while the django-fcgi script parses it operates as expected.

  1. emerge nginx django flup pycrypto
  2. mkdir mkdir /var/django/{run,sites,media} -p
  3. cd /var/django/sites
  4. Deploy files attached below (on this page) to /var/django/
    1. django-fcgi
    2. django-nginx
    3. sites.list
  5. ln -s /var/django/django-fcgi /etc/init.d
  6. ln -s /var/django/django-nginx /etc/nginx/sites-enabled/ 
  7. rc-update add django-fcgi default
  8. rc-update add nginx default
  9. startproject sample
  10. /etc/init.d/django-fcgi restart
  11. /etc/init.d/nginx restart
It's possible I missed a couple steps in documenting this, but doubtful. My shell log shows lots of other debugging tasks in between. Errors will show up either in running the above sequence, or (especially) /var/log/nginx/*_log

Sam Briesemeister,
Feb 18, 2011, 5:34 PM
Sam Briesemeister,
Feb 18, 2011, 5:34 PM
Sam Briesemeister,
Feb 18, 2011, 5:34 PM