unity发布webGL压缩方式的gzip,使用nginx作为web服务器时的配置文件

本文主要是介绍unity发布webGL压缩方式的gzip,使用nginx作为web服务器时的配置文件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

unity发布webGL压缩方式的gzip,使用nginx作为web服务器时的配置文件

Unity版本是:2021.3
nginx的版本是:nginx-1.25.4

Unity发布webgl时的测试

设置压缩方式是gzip
设置压缩方式是gzip

nginx配置文件

worker_processes  1;events {worker_connections  1024;
}http {include       mime.types;default_type  application/octet-stream;sendfile        on;keepalive_timeout  65;server {listen       7963;server_name  localhost;location / {root   html;index  index.html index.htm;add_header Access-Control-Allow-Origin *;add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';}# On-disk Brotli-precompressed data files should be served with compression enabled:location ~ .+\.(data|symbols\.json)\.br$ {# Because this file is already pre-compressed on disk, disable the on-demand compression on it.# Otherwise nginx would attempt double compression.gzip off;add_header Content-Encoding br;default_type application/octet-stream;}# On-disk Brotli-precompressed JavaScript code files:location ~ .+\.js\.br$ {gzip off; # Do not attempt dynamic gzip compression on an already compressed fileadd_header Content-Encoding br;default_type application/javascript;}# On-disk Brotli-precompressed WebAssembly files:location ~ .+\.wasm\.br$ {gzip off; # Do not attempt dynamic gzip compression on an already compressed fileadd_header Content-Encoding br;# Enable streaming WebAssembly compilation by specifying the correct MIME type for# Wasm files.default_type application/wasm;}# On-disk gzip-precompressed data files should be served with compression enabled:location ~ .+\.(data|symbols\.json)\.gz$ {gzip off; # Do not attempt dynamic gzip compression on an already compressed fileadd_header Content-Encoding gzip;default_type application/octet-stream;}# On-disk gzip-precompressed JavaScript code files:location ~ .+\.js\.gz$ {gzip off; # Do not attempt dynamic gzip compression on an already compressed fileadd_header Content-Encoding gzip;default_type application/javascript;}# On-disk gzip-precompressed WebAssembly files:location ~ .+\.wasm\.gz$ {gzip off; # Do not attempt dynamic gzip compression on an already compressed fileadd_header Content-Encoding gzip;# Enable streaming WebAssembly compilation by specifying the correct MIME type for# Wasm files.default_type application/wasm;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}
}

参考文档有:
文档链接:WebGL:压缩构建和服务器配置:https://docs.unity.cn/cn/2020.3/Manual/webgl-deploying.html
文档链接:WebGL:服务器配置代码示例:https://docs.unity.cn/cn/2020.3/Manual/webgl-server-configuration-code-samples.html

Enjoy

看不懂或者其他的欢迎私信评论

这篇关于unity发布webGL压缩方式的gzip,使用nginx作为web服务器时的配置文件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/747372

相关文章

Python中模块graphviz使用入门

《Python中模块graphviz使用入门》graphviz是一个用于创建和操作图形的Python库,本文主要介绍了Python中模块graphviz使用入门,具有一定的参考价值,感兴趣的可以了解一... 目录1.安装2. 基本用法2.1 输出图像格式2.2 图像style设置2.3 属性2.4 子图和聚

windows和Linux使用命令行计算文件的MD5值

《windows和Linux使用命令行计算文件的MD5值》在Windows和Linux系统中,您可以使用命令行(终端或命令提示符)来计算文件的MD5值,文章介绍了在Windows和Linux/macO... 目录在Windows上:在linux或MACOS上:总结在Windows上:可以使用certuti

CentOS和Ubuntu系统使用shell脚本创建用户和设置密码

《CentOS和Ubuntu系统使用shell脚本创建用户和设置密码》在Linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设置密码,本文写了一个shell... 在linux系统中,你可以使用useradd命令来创建新用户,使用echo和chpasswd命令来设

Python使用Matplotlib绘制3D曲面图详解

《Python使用Matplotlib绘制3D曲面图详解》:本文主要介绍Python使用Matplotlib绘制3D曲面图,在Python中,使用Matplotlib库绘制3D曲面图可以通过mpl... 目录准备工作绘制简单的 3D 曲面图绘制 3D 曲面图添加线框和透明度控制图形视角Matplotlib

Pandas中统计汇总可视化函数plot()的使用

《Pandas中统计汇总可视化函数plot()的使用》Pandas提供了许多强大的数据处理和分析功能,其中plot()函数就是其可视化功能的一个重要组成部分,本文主要介绍了Pandas中统计汇总可视化... 目录一、plot()函数简介二、plot()函数的基本用法三、plot()函数的参数详解四、使用pl

gradle第三方Jar包依赖统一管理方式

《gradle第三方Jar包依赖统一管理方式》:本文主要介绍gradle第三方Jar包依赖统一管理方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录背景实现1.顶层模块build.gradle添加依赖管理插件2.顶层模块build.gradle添加所有管理依赖包

使用Python实现IP地址和端口状态检测与监控

《使用Python实现IP地址和端口状态检测与监控》在网络运维和服务器管理中,IP地址和端口的可用性监控是保障业务连续性的基础需求,本文将带你用Python从零打造一个高可用IP监控系统,感兴趣的小伙... 目录概述:为什么需要IP监控系统使用步骤说明1. 环境准备2. 系统部署3. 核心功能配置系统效果展

使用Java将各种数据写入Excel表格的操作示例

《使用Java将各种数据写入Excel表格的操作示例》在数据处理与管理领域,Excel凭借其强大的功能和广泛的应用,成为了数据存储与展示的重要工具,在Java开发过程中,常常需要将不同类型的数据,本文... 目录前言安装免费Java库1. 写入文本、或数值到 Excel单元格2. 写入数组到 Excel表格

redis中使用lua脚本的原理与基本使用详解

《redis中使用lua脚本的原理与基本使用详解》在Redis中使用Lua脚本可以实现原子性操作、减少网络开销以及提高执行效率,下面小编就来和大家详细介绍一下在redis中使用lua脚本的原理... 目录Redis 执行 Lua 脚本的原理基本使用方法使用EVAL命令执行 Lua 脚本使用EVALSHA命令

Linux之systemV共享内存方式

《Linux之systemV共享内存方式》:本文主要介绍Linux之systemV共享内存方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、工作原理二、系统调用接口1、申请共享内存(一)key的获取(二)共享内存的申请2、将共享内存段连接到进程地址空间3、将