nginx.conf.sample 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # vim:sw=4 ts=4 et:
  2. #
  3. # This is a sample nginx configuration for a Wagtail application running under
  4. # uWSGI.
  5. server {
  6. # We don't set 'root' here, because we send location / to uWSGI, so
  7. # nothing ends up at nginx's default handler.
  8. listen 80;
  9. server_name mywagtail.org;
  10. error_log /var/log/nginx/mywagtail.org_error.log;
  11. access_log /var/log/nginx/mywagtail.org_access.log;
  12. # Maximum file upload size.
  13. client_max_body_size 64M;
  14. # Enable content compression for text types.
  15. gzip on;
  16. gzip_types text/plain text/css application/x-javascript image/svg+xml;
  17. gzip_comp_level 1;
  18. gzip_disable msie6;
  19. gzip_http_version 1.0;
  20. gzip_proxied any;
  21. gzip_vary on;
  22. location /static/ {
  23. access_log off;
  24. expires 3600;
  25. alias /home/mywagtail/app/static/;
  26. }
  27. # Set a longer expiry for CACHE/, because the filenames are unique.
  28. location /static/CACHE/ {
  29. access_log off;
  30. expires 864000;
  31. alias /home/mywagtail/app/static/CACHE/;
  32. }
  33. # Only serve /media/images/ by default, not e.g. original_images/.
  34. location /media/images/ {
  35. expires 864000;
  36. alias /home/mywagtail/app/media/images/;
  37. }
  38. location / {
  39. include uwsgi_params;
  40. uwsgi_pass unix:/home/mywagtail/mywagtail.sock;
  41. break;
  42. }
  43. }