2
0

uwsgi.conf.sample 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # vim:sw=4 ts=4 et:
  2. #
  3. # This is a sample uWSGI configuration file for running a Wagtail application.
  4. # It's designed to run under uWSGI's Emperor mode[0], but should work fine as
  5. # a standalone instance, e.g. under supervisord using
  6. # 'uwsgi --ini /path/to/wagtail.ini'.
  7. #
  8. # This configuration assumes an application called 'mywagtail', running under
  9. # the 'mywagtail' user account, with the application deployed in
  10. # /home/mywagtail/app and the virtualenv in /home/mywagtail/venv.
  11. #
  12. # [0] https://uwsgi-docs.readthedocs.org/en/latest/Emperor.html
  13. [uwsgi]
  14. # Abort on unknown configuration options.
  15. strict = true
  16. uid = mywagtail
  17. gid = mywagtail
  18. umask = 022
  19. # Report memory usage to check for leaks; optional.
  20. memory-report = true
  21. # Change these paths to where uWSGI is installed on your system. If you've
  22. # installed uWSGI with pip, then you won't have any plugins, so plugin-dir
  23. # can be omitted.
  24. binary-path = /opt/tbx/bin/uwsgi
  25. plugin-dir = /opt/tbx/lib/uwsgi/plugins
  26. # Shut down worker processes when we exit.
  27. no-orphans = true
  28. # Provide a statistics socket for uwsgitop; optional.
  29. stats = /home/mywagtail/mywagtail.stats
  30. # Run in master mode.
  31. master = true
  32. # Set this to the root directory of your project.
  33. chdir = /home/mywagtail/app
  34. # ... and its virtualenv.
  35. virtualenv = /home/mywagtail/venv
  36. # Create a UNIX socket that the web server can access. Replace 'www-data'
  37. # with the group (not the user) that your web server runs as.
  38. #
  39. # To use FastCGI instead of the uWSGI protocol, replace 'uwsgi-socket' with
  40. # 'fastcgi-socket'.
  41. uwsgi-socket = /home/mywagtail/mywagtail.sock
  42. chmod-socket = 660
  43. chown-socket = mywagtail:www-data
  44. # The number of worker processes to create.
  45. workers = 5
  46. # Create multiple threads per worker. This is more memory-efficient if your
  47. # application is thread-safe.
  48. enable-threads = true
  49. threads = 5
  50. # Use cheaper to kill off idle workers. This doesn't always work well; for
  51. # example, on Debian 7 with recently uWSGI versions it appears to sometimes
  52. # deadlock the application when killing a worker. If this isn't specified,
  53. # uWSGI will just create the maximum number of workers at all times.
  54. cheaper-algo = spare
  55. cheaper = 1
  56. cheaper-initial = 1
  57. cheaper-step = 1
  58. # Application environment.
  59. env = PATH=/home/mywagtail/venv/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
  60. env = HOME=/home/mywagtail
  61. # Set $PYTHONPATH so that 'django-admin' works without needing the
  62. # virtualenv active.
  63. env = PYTHONPATH=/home/mywagtail/app/mywagtail
  64. # Settings module.
  65. env = DJANGO_SETTINGS_MODULE=myapp.settings.production
  66. # WSGI application. Wagtail includes this in the default template.
  67. module = mywagtail.wsgi:application
  68. # You can run additional daemons along with the application; for example,
  69. # if you want to run Celery:
  70. attach-daemon = celery worker -A myceleryapp -C -c1
  71. attach-daemon = celery beat -A myceleryapp -C
  72. # Log errors and requests.
  73. logto = /var/log/uwsgi/mywagtail.log
  74. log-date = true
  75. log-prefix = [mywagtail]
  76. logfile-chown = true
  77. # Enable thunder lock to prevent the thundering herd problem.
  78. thunder-lock = true
  79. pcre-jit = true
  80. close-on-exec = true
  81. buffer-size = 16384