Site configuration file for unity webgl using Brotli compression:
server {
listen 80;
listen [::]:80;
server_name sitename.com;
return https://sitename.com$request_uri;
}
server {
listen 443;
listen [::]:443;
server_name unity.ntalam.com;
root /directory/path/unity;
index index.php index.html;
#using Brotli compression
brotli on;
location ~ .+\.(data|symbols\.json)$ {
default_type application/octet-stream-compressible;
}
location ~ .+\.data\.br$ {
add_header Content-Encoding br;
default_type application/octet-stream;
}
location ~ .+\.wasm\.br$ {
add_header Content-Encoding br;
default_type application/wasm;
}
location ~ .+\.js\.br$ {
add_header Content-Encoding br;
default_type application/javascript;
}
location ~ .+\.js$ {
default_type application/javascript;
}
location ~ .+\.wasm$ {
default_type application/wasm;
}
#SSL certificates
ssl_certificate /etc/letsencrypt/live/sitename.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sitename.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}