【电商】nginx问题记录
1. 反向代理时,header信息丢失自定义的header中带有下划线,nginx在做反向代理时,会认为这样的header是无效的,所以没有进行转发,需要配置underscores_in_headers,默认为off,改为on即可.
语法:
Syntax:underscores_in_headers on | off;
Default:
underscores_in_headers off;
Context: http, server
参见:http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers
2. upstream sent invalid chunked response while reading upstream
出现该问题的原因未知,
解决方法,增加下面的配置:
proxy_http_version 1.1;
配置项proxy_http_version的默认值为1.0,所以怀疑与1.1中的keepalive特性有关
3. nginx虚拟主机
配置方式:
server {
listen 80 ;
server_name jenkins.xxx.cn;
location / {
proxy_pass http://127.0.0.1:7081;
}
}
如果要配置多个虚拟主机,为保证多个主机可用,如果有一个default的主机(默认已经有了),即:
listen 80 default;
页:
[1]