- 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.
- Vue.js 3.x快速入門
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- Design Principles for Process:driven Architectures Using Oracle BPM and SOA Suite 12c
- JavaScript全程指南
- Computer Vision for the Web
- C/C++算法從菜鳥到達人
- 青少年美育趣味課堂:XMind思維導圖制作
- Python Network Programming Cookbook(Second Edition)
- STM32F0實戰:基于HAL庫開發
- Solr Cookbook(Third Edition)
- Windows Embedded CE 6.0程序設計實戰
- C語言程序設計實訓教程與水平考試指導
- Kotlin極簡教程
- Android應用開發實戰(第2版)
- Python+Office:輕松實現Python辦公自動化