No Description

nginx.conf 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. worker_processes ${{NUM_WORKERS}};
  2. daemon on;
  3. pid logs/nginx.pid;
  4. events {
  5. worker_connections 1024;
  6. }
  7. http {
  8. charset UTF-8;
  9. include mime.types;
  10. server_tokens off;
  11. # blocking non-local requests
  12. geo $bad_client {
  13. default 1;
  14. 127.0.0.1 0;
  15. }
  16. server {
  17. listen ${{PORT}};
  18. lua_code_cache ${{CODE_CACHE}};
  19. if ($bad_client) {
  20. return 301 https://${{DOMAIN}}/$request_uri; #permanent
  21. }
  22. location / {
  23. default_type text/html;
  24. set $_url "";
  25. content_by_lua '
  26. require("lapis").serve("app")
  27. ';
  28. }
  29. location /proxy {
  30. internal;
  31. rewrite_by_lua "
  32. local req = ngx.req
  33. for k,v in pairs(req.get_headers()) do
  34. if k ~= 'content-length' then
  35. req.clear_header(k)
  36. end
  37. end
  38. if ngx.ctx.headers then
  39. for k,v in pairs(ngx.ctx.headers) do
  40. req.set_header(k, v)
  41. end
  42. end
  43. ";
  44. resolver 8.8.8.8;
  45. proxy_http_version 1.1;
  46. proxy_pass $_url;
  47. }
  48. location /static/ {
  49. alias static/;
  50. }
  51. location /favicon.ico {
  52. alias static/favicon.ico;
  53. }
  54. }
  55. }