nginx.conf 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. error_log nginx_main_error.log info;
  6. pid nginx_user.pid;
  7. daemon off;
  8. http {
  9. access_log nginx_access.log;
  10. error_log nginx_error.log info;
  11. types {
  12. text/html html htm shtml;
  13. text/css css;
  14. application/javascript js;
  15. application/wasm wasm;
  16. image/png png;
  17. image/jpeg jpg jpeg;
  18. image/svg+xml svg;
  19. }
  20. default_type application/octet-stream;
  21. sendfile on;
  22. server {
  23. # listen 8080 ssl;
  24. listen 8081;
  25. server_name localhost;
  26. gzip on;
  27. # Enable compression for .wasm, .js and .txt files (used for the runtime chunks)
  28. gzip_types application/javascript application/wasm text/plain application/octet-stream;
  29. charset utf-8;
  30. # ssl_certificate nginx.crt;
  31. # ssl_certificate_key nginx.key;
  32. location / {
  33. root build;
  34. autoindex on;
  35. index index.html index.htm;
  36. add_header 'Cross-Origin-Opener-Policy' 'same-origin' always;
  37. add_header 'Cross-Origin-Embedder-Policy' 'require-corp' always;
  38. add_header 'Cross-Origin-Resource-Policy' 'cross-origin' always;
  39. }
  40. add_header Content-Security-Policy "
  41. script-src 'self', 'wasm-unsafe-eval';
  42. script-src-elem 'self';
  43. worker-src 'self', 'wasm-unsafe-eval', blob:';
  44. connect-src 'self', 'https:', 'blob:', 'data:', 'wss:';
  45. require-trusted-types-for 'script';
  46. frame-src 'self', 'https:', 'blob:', 'data:';
  47. img-src 'self', 'https:', 'blob:', 'data:';
  48. media-src 'self', 'https:', 'blob:', 'data:';
  49. font-src 'self', 'blob:', 'data:';
  50. style-src 'self', 'unsafe-inline';
  51. object-src 'none';
  52. base-uri 'none';
  53. default-src 'self';
  54. frame-ancestors 'self';
  55. " always;
  56. }
  57. }