NIT*_*MAR 6 gzip nginx node.js amazon-elastic-beanstalk
根据文档,他们已使用 Amazon Linux 2 平台版本上的配置删除了 Gzip压缩选项。
由于所有基于 AL2 的平台都使用 nginx 作为默认反向代理,因此您可以通过覆盖默认的 nginx.conf 或添加其他配置文件来在 nginx 配置中打开 Gzip压缩。
To extend the Elastic Beanstalk default nginx configuration, add .conf configuration files to a folder named .platform/nginx/conf.d/ in your application source bundle. The Elastic Beanstalk nginx configuration includes .conf files in this folder automatically.
~/workspace/my-app/
|-- .platform
| `-- nginx
| `-- conf.d
| `-- myconf.conf
`-- other source files
To override the Elastic Beanstalk default nginx configuration completely, include a configuration in your source bundle at .platform/nginx/nginx.conf:
~/workspace/my-app/
|-- .platform
| `-- nginx
| `-- nginx.conf
`-- other source files
Run Code Online (Sandbox Code Playgroud)
在基于 AL2 的 EB 平台的 nginx 默认配置中,nginx.conf 文件中已经有 gzip 压缩选项,即“gzip off;”。如果您选择扩展默认的 nginx 配置,您还需要删除 nginx.conf 文件中的此配置。
应包含在 nginx 配置文件中的 gzip 配置如下所示。
gzip on;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1119 次 |
最近记录: |