The value of cookies is out of range I mean
Looked at the logs
Error 502 upstream sent too big header while reading response header from upstream
sudo gedit /var/log/nginx/error.log
check the error log
upstream sent too big header while reading response header from upstream
If you search for this error, the explanation on the Internet is similar, but it’s just that the cookie carries too much header and makes you set.
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
Try it step by step. The phrase fastcgi_buffers 8 128k, fastcgi_buffers 32 32k is better, the memory is allocated and released as a whole, reduce the number of units k can be used as much as possible.
In addition, if you use nginx for load balancing, it is useless to change the above parameters, to be in the configuration of forwarding, such as the following settings.
location @to_other {
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
add_header X-Static transfer;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backend;
}
The three bolded lines are the only ones that will work.
fastcgi_* can be interpreted as the response used by nginx when accepting client requests. proxy is used by nginx when forwarding as a client, if the header is too big and exceeds the default 1k, it will trigger the above upstream sent too big header.
location ~ \.php$ {
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /host/web/$fastcgi_script_name;
}