nginx.conf
server {
listen 80;
server_name _;
#前端
location / {
index index.html index.htm; #添加属性。
root html; #站点目录
}
#后台接口设置代理转发
location /标识 {
proxy_pass 代理地址/;
}
}
对接sse
server {
listen 80;
server_name _;
#前端
location / {
index index.html index.htm; #添加属性。
root html; #站点目录
}
#后台接口设置代理转发
location /标识 {
proxy_pass 代理地址/;
# EventSource的魔术三重奏
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}
此处配置参考EventSource /服务器通过Nginx发送事件 _大数据知识库 帖子中的讨论