File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,17 +11,22 @@ server {
1111 # }
1212
1313 location /api/ {
14- include uwsgi_params;
15- uwsgi_pass 127.0.0.1:5000 ;
14+ proxy_set_header Host $host ;
15+ proxy_set_header X-Real-IP $remote_addr ;
16+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
17+ proxy_pass http ://127.0.0.1:5000 /api/;
1618 }
1719
1820 location /socket.io/ {
19- include uwsgi_params;
20- uwsgi_pass 127.0.0.1:5000 ;
21-
22- # WebSocket support
23- uwsgi_read_timeout 86400 ;
24- uwsgi_send_timeout 86400 ;
21+ proxy_http_version 1.1;
22+ proxy_buffering off;
23+ proxy_set_header Upgrade $http_upgrade ;
24+ proxy_set_header Connection "upgrade" ;
25+ proxy_set_header Host $host ;
26+ proxy_set_header X-Real-IP $remote_addr ;
27+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
28+ proxy_read_timeout 86400 ;
29+ proxy_pass http ://127.0.0.1:5000 /socket.io/;
2530 }
2631
2732 location / {
Original file line number Diff line number Diff line change 11#! /bin/bash
22cd /usr/share/nginx/backend/
33
4- # Start uWSGI with socket (not HTTP) for nginx uwsgi_pass
5- uwsgi --socket 127.0.0.1:5000 \
6- --protocol uwsgi \
7- --gevent 1000 \
8- --gevent-monkey-patch \
9- --master \
10- --wsgi-file __main__.py \
11- --callable app \
12- --processes 1 \
13- --threads 1 \
14- --buffer-size 32768 \
15- --lazy-apps &
4+ # Run Flask-SocketIO directly with gevent (bypass uWSGI for WebSocket support)
5+ python3 -m backend &
166
177nginx -g ' daemon off;'
You can’t perform that action at this time.
0 commit comments