Skip to content

Commit 9795f7b

Browse files
More updates for nignx and uwsgi
1 parent 6c7aa86 commit 9795f7b

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

nginx.conf

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff 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 / {

services.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
#!/bin/bash
22
cd /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

177
nginx -g 'daemon off;'

0 commit comments

Comments
 (0)