我不知道为什么在nginx中使用gzip时会错过http响应“ Content-Length header”,我真的被卡住了,请有人帮帮我,非常感谢!这是我的配置文件,nginx.conf用户无人无人; worker_processes 8;events {worker_connecti...
我不知道为什么在nginx中使用gzip时会错过http响应“ Content-Length header”,我真的被卡住了,请有人帮帮我,非常感谢!
这是我的配置文件,
nginx.conf
用户无人无人;
worker_processes 8;
events {
worker_connections 1024;
accept_mutex on; # "on" if nginx worker_processes > 1
use epoll; # enable for Linux 2.6+
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
upstream backend-unicorn {
server unix:/tmp/unicorn_app.sock fail_timeout=0;
#server localhost:5000;
}
#access_log logs/access.log main;
sendfile on;
keepalive_timeout 100;
gzip on;
gzip_static on;
gzip_proxied any;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain application/zip text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image$
server {
listen 8080;
server_name misago;
access_log /var/log/nginx/unicorn.access.log main;
client_max_body_size 64M;
location /uploads/ {
root /usr/local/rails_apps/me_management_tool/current/public/uploads;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
解决方法:
I don’t know why http response is missed “Content-Length header” when I use gzip in nginx
因为在这种情况下,发送标头时内容的长度是未知的. Nginx无法知道内容压缩的程度.
沃梦达教程
本文标题为:ruby-on-rails-使用Nginx Gzip Unicorn时缺少Content-Length标头
基础教程推荐
猜你喜欢
- Go web部署报错panic: listen tcp xxxxxxx:8090: bind: cannot assign requested address 2023-09-05
- ruby-on-rails-使用Nginx的Rails的多阶段环境 2023-09-21
- swift版webview加载网页进度条效果 2023-07-05
- R语言基于Keras的MLP神经网络及环境搭建 2022-12-10
- swift 字符串String的使用方法 2023-07-05
- R语言数可视化Split violin plot小提琴图绘制方法 2022-12-10
- R语言-如何将科学计数法表示的数字转化为文本 2022-11-23
- UEFI开发基础HII代码示例 2023-07-07
- asm基础——汇编指令之in/out指令 2023-07-06
- R包ggtreeExtra绘制进化树 2022-12-14