- NGINX Cookbook
- Tim Butler
- 152字
- 2021-07-03 00:04:29
How it works....
There's only one main block directive to get our simple test working, with a few key areas.
proxy_pass http://127.0.0.1:3000;
The proxy will forward the connection back to our Express-driven test application, which we configured to listen on port 3000 of the localhost.
proxy_http_version 1.1;
By default, proxied connections back to the Node.js application will be HTTP/1.0 only. Setting this to HTTP/1.1 allows the use of keep-alive, which means the connection between NGINX and the application remains open rather than establishing a new connection every time. On a heavily loaded system, this is much more efficient.
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
The WebSocket protocol uses the Upgrade and Connection headers as part of the handshake process. We need to set this at the NGINX level in order to allow the handshake process to work as expected. As it's compatible with HTTP/1.1, it won't interfere with the standard connections either.
- Building a Home Security System with Raspberry Pi
- Visual FoxPro 程序設(shè)計
- INSTANT MinGW Starter
- INSTANT CakePHP Starter
- 差分進(jìn)化算法及其高維多目標(biāo)優(yōu)化應(yīng)用
- R Deep Learning Cookbook
- 從零開始學(xué)Linux編程
- Spring Boot+MVC實戰(zhàn)指南
- Unity&VR游戲美術(shù)設(shè)計實戰(zhàn)
- Elasticsearch Essentials
- 創(chuàng)意UI Photoshop玩轉(zhuǎn)移動UI設(shè)計
- Qt 4開發(fā)實踐
- 寫給青少年的人工智能(Python版·微課視頻版)
- 游戲設(shè)計的底層邏輯
- 基于JavaScript的WebGIS開發(fā)