location / {
...
proxy_set_header Accept-Encoding "gzip";
...
proxy_pass ...;
}
分类目录归档:Nginx
$realpath_root 和 $document_root 区别
nginx: worker process is shutting down
nginx: worker process is shutting down,这个是nginx reload后可能会出现的,应该是继续处理未结束线程用的。
如果你的超时相关配置设置了很长时间,那么这个线程也会存在很长时间。
关于`a client request body is buffered to a temporary file /var/cache/nginx/client_temp/…`的问题
很多教程是改`client_body_buffer_size
`我觉得这样不太好,因为:
- 非常吃内存
- 不符合流式传输,无法立即刷送
另外一种解决方案是:(关闭缓冲即可)
fastcgi_buffering off;
fastcgi_request_buffering off;
弄清楚thinkphp的nginx配置问题
Nginx限流
https://blog.csdn.net/m0_45406092/article/details/124713027
要点:
Example Configuration
http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; ... server { ... location /search/ { limit_req zone=one burst=5; }
rate=1r/s; 表示 1请求每秒,也可以是 rate=30r/m;(30请求每分)
$binary_remote_addr 表示根据 ip v4或者 ip v6地址来限制流量
burst=5;表示突发请求不超过5个
nginx 指定下载文件的文件名
server {
.....
location ~* .*\.(doc|txt|jar|zip|apk)(\?.*)?$ {
if ($request_uri ~* ^.*\/(.*)\.(doc|txt|jar|zip|apk)(\?name=([^&]+))$) {
add_header Content-Disposition "attachment;filename=$arg_name.$2";
}
}
Nginx proxy_pass https 间歇性502,浏览器一段时间静置后502
client intended to send too large body
加大Nginx的 client_max_body_size :
client_max_body_size 256m;
nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
把server_names_hash_bucket_size改大点即可,可以改成64或128试下,放在http {}里
Syntax: | server_names_hash_bucket_size size; |
---|---|
Default: | server_names_hash_bucket_size 32|64|128; |
Context: | http |
Sets the bucket size for the server names hash tables. The default value depends on the size of the processor’s cache line. The details of setting up hash tables are provided in a separate document.