【发布时间】:2020-01-15 21:49:27
【问题描述】:
我有一个用python和flask框架编写的电子商务项目,我在会话中保留购物车信息,当我尝试将产品添加到会话时,nginx给出了这个错误:
上游从上游读取响应头时发送的头太大,客户端:xx.xxx.xx.xxx,服务器:mysite.com,请求:“POST /add_to_cart HTTP/1.1”,上游:“uwsgi://unix :/path/uwsgi.sock:", 主机: "mysite.com"
当我在会话中有很多信息时会发生这种情况,
我尝试添加fastcgi和proxy_buffer参数,但还是不行,这是我的nginx conf文件:
server {
listen 443 ssl;
server_name mysite.com;
ssl_certificate /path/nginx.pem;
ssl_certificate_key /path/nginx.key;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
access_log /path/access.log main;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
proxy_buffering on;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
location /static/ {
alias /path/web/static/;
access_log off;
index index.html index.htm;
}
location / {
try_files $uri @uwsgi;
root /path/www/;
index index.html index.htm;
}
location @uwsgi {
include uwsgi_params;
uwsgi_pass unix:/path/web/uwsgi.sock;
}
}
【问题讨论】:
-
向我们展示您与会话相关的代码以及会话系统的设置方式。
标签: python linux nginx flask nginx-config