worker_processes 1; events { worker_connections 1024; } error_log nginx_main_error.log info; pid nginx_user.pid; daemon off; http { access_log nginx_access.log; error_log nginx_error.log info; include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; server { listen 8080; server_name my_domain; gzip on; # Enable compression for .wasm, .js and .txt files (used for the runtime chunks) gzip_types application/javascript application/wasm text/plain; charset utf-8; location @do204 { add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'content-length' always; return 204; } location / { root .; autoindex on; index index.html index.htm; # Enable cross origin access to CheerpJ runtime add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'content-length' always; # During normal operations some not-existing files can be accessed # 404 errors may be unpleasant and confusing for users, so replace them with 204 (HTTP No Content) error_page 404 = @do204; } } }