- Java WebSocket + tail命令实现Web实时日志
- springboot websocket简单入门
- nginx websocket简介及配置
- Nginx配置Basic Auth登录认证
mvn clean package
java -jar -Dcmd.tail.path=日志文件绝对路径 target/websocket-tail-1.0.0.jar
浏览器访问 http://localhost:8765/ 即可
upstream ws_server {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name ws.repo;
location / {
proxy_pass http://ws_server/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
核心配置就下面这三行
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";