diff --git a/etc/lighttpd/91-fcgi-mhapi.conf b/etc/lighttpd/91-fcgi-mhapi.conf new file mode 100644 index 0000000..b3a019b --- /dev/null +++ b/etc/lighttpd/91-fcgi-mhapi.conf @@ -0,0 +1,15 @@ +# This assumes mod_fastcgi is already enabled by other config and +# that the git repository is checked out in /var/www. Change as +# needed. +fastcgi.server += ( "/mhapi/" => + (( + "bin-path" => "/var/www/monster-hunter-scripts/bin/mhapi_fcgi.py", + "socket" => "/var/run/lighttpd/fcgi-mhapi.socket", + "check-local" => "disable", + "min-procs" => 1, + "max-procs" => 10, + "bin-environment" => ( + "PYTHONPATH" => "/var/www/monster-hunter-scripts", + ), + )) +) diff --git a/etc/nginx/conf.d/uwsgi-cache.conf b/etc/nginx/conf.d/uwsgi-cache.conf new file mode 100644 index 0000000..74005cd --- /dev/null +++ b/etc/nginx/conf.d/uwsgi-cache.conf @@ -0,0 +1,6 @@ +# Cache in the tmpfs filesystem for speed, max 50m (out of 100mb total) + +uwsgi_cache_path /run/uwsgi/app/cache + keys_zone=mhapi:10m + max_size=50m; +uwsgi_temp_path /run/uwsgi/app/tmp; diff --git a/etc/nginx/sites-available/mhapi b/etc/nginx/sites-available/mhapi new file mode 100644 index 0000000..0e958b8 --- /dev/null +++ b/etc/nginx/sites-available/mhapi @@ -0,0 +1,27 @@ +server { + listen 80; + server_name HOSTNAME; + + root STATICROOT; + index index.html; + + location /mhapi/ { + uwsgi_pass unix:///run/uwsgi/app/mhapi/mhapi.socket; + include uwsgi_params; + uwsgi_param UWSGI_SCHEME $scheme; + uwsgi_param SERVER_SOFTWARE nginx/$nginx_version; + uwsgi_cache mhapi; + uwsgi_cache_key $request_uri; + uwsgi_cache_valid 200 302 1h; + uwsgi_cache_valid 301 1d; + uwsgi_cache_valid any 1m; + uwsgi_cache_min_uses 1; + uwsgi_cache_use_stale error timeout invalid_header http_500; + } + + gzip on; + gzip_disable "msie6"; + gzip_min_length 500; + gzip_proxied no-store no-cache private expired auth; + gzip_types text/plain text/css application/json; +} diff --git a/etc/uwsgi/apps-available/mhapi.ini b/etc/uwsgi/apps-available/mhapi.ini new file mode 100644 index 0000000..c48c480 --- /dev/null +++ b/etc/uwsgi/apps-available/mhapi.ini @@ -0,0 +1,19 @@ +[uwsgi] +plugin = python +socket = /run/uwsgi/app/mhapi/mhapi.socket + +pythonpath = /PATH/TO/monster-hunter-scripts/ +module = mhapi.web.wsgi:application + +master = yes +processes = 4 +harakiri = 60 +reload-mercy = 8 +cpu-affinity = 1 +stats = /tmp/stats.socket +max-requests = 2000 +limit-as = 512 +reload-on-as = 256 +reload-on-rss = 192 +no-orphans = yes +vacuum = yes