nginx - How to set fastcgi_params_hash_max_size?
问题描述
On my Ubuntu server running Nginx + FastCGI (via Webinoly), nginx -t throws the following warning:
nginx: [warn] could not build optimal fastcgi_params_hash,
you should increase either fastcgi_params_hash_max_size: 512 or
fastcgi_params_hash_bucket_size: 64; ignoring fastcgi_params_hash_bucket_size
At first I thought that I had to change server_names_hash_max_size, but it was already set to 2048 and was unrelated. To make sure, I tried lowering its value to 8, at which nginx -t threw a warning that I should increase it. After restoring it, I got back the initial warning about fastcgi_params_hash_max_size.
I also tried setting fastcgi_params_hash_max_size on my nginx.conf file, but then I got an error that fastcgi_params_hash_max_size is an unknown directive.
So, I guess my question is, how can I change the fastcgi_params_hash_max_size?
Thanks in advance!
解决方案
确实没有fastcgi_params_hash_max_size
和fastcgi_params_hash_bucket_size
指令。此错误消息是“自动”的,它采用哈希名称(在本例中fastcgi_params_hash
),然后通过附加_max_size
and构造建议的指令名称_bucket_size
。
NGINX 哈希通常用于存储类似数组的配置数据,如map
s 或fastcgi_params
s (您的情况),并且有关于它们的单独文档不得不说:
大多数散列具有允许更改这些参数的相应指令,例如,对于服务器名称散列,它们是 server_names_hash_max_size 和 server_names_hash_bucket_size。
所以你的哈希没有“相应的指令”,除了:
- 调查为什么您的配置中有太多
fastcgi_param
指令?(或具有太多冗长的值)。您很可能对fastcgi_params
s 有次优配置。请记住,这些被传递给 FastCGI(例如 PHP-FPM),如果数据太大,那么您肯定会遇到性能问题,因为 NGINX-PHP-FPM 之间传递的数据过多。 - 向 NGINX 提交关于添加这些指令的错误问题
推荐阅读
- maven - 我可以使用什么 Maven 命令来恢复部署或“构建?
- java - Findbugs:RV_RETURN_VALUE_IGNORED_BAD_PRACTICE 使用 ExecutorService
- java - GCP 数据存储区查询嵌套实体引用 (entityB.name)
- mysql - 在 MySQL 中,我可以要求它在同一实例中将数据库完全克隆到新数据库吗?
- android - Android ChipDrawable 宽度不能填满他的父母
- vue.js - vue.js 获取所选选项的值并将其传递给另一个子组件的问题
- intellij-idea - 为什么当我在项目资源管理器中右键单击文件夹并选择“在终端中打开”时,intellij 会打开两个终端?
- android - 如何在不与 Google Cloud 共享数据的情况下将数据从智能手表同步到智能手机?
- javascript - 将基于数据的流线添加到 Leaflet.canvas-Flowmaplayer
- python - 用其他 numpy 数组填充 numpy 数组