Skip to content

Commit 8dd37b2

Browse files
committed
further nginx optimization and frontend resource update
1 parent ddec46c commit 8dd37b2

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

service/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
deploy:
1414
resources:
1515
limits:
16-
cpus: '0.25'
16+
cpus: '0.45'
1717
memory: 100M
1818
networks:
1919
- memorais_network
@@ -91,7 +91,7 @@ services:
9191
deploy:
9292
resources:
9393
limits:
94-
cpus: '1.55'
94+
cpus: '1.35'
9595
memory: 650M
9696
networks:
9797
- memorais_network

service/frontend/nginx.conf

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
events { worker_connections 1024; }
1+
worker_processes auto;
2+
3+
events {
4+
use epoll;
5+
worker_connections 2048;
6+
multi_accept on;
7+
}
28

39
http {
410
include mime.types;
511
default_type application/octet-stream;
6-
sendfile on;
7-
keepalive_timeout 65;
12+
13+
sendfile on;
14+
tcp_nopush on;
15+
tcp_nodelay on;
16+
keepalive_timeout 30;
17+
types_hash_max_size 2048;
18+
19+
gzip on;
20+
gzip_disable "msie6";
21+
gzip_vary on;
22+
gzip_proxied any;
23+
gzip_comp_level 3;
24+
gzip_buffers 16 8k;
25+
gzip_http_version 1.1;
26+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
27+
828

929
server {
1030
listen 80;
@@ -15,24 +35,20 @@ http {
1535
root /usr/share/nginx/html;
1636
index index.html;
1737
try_files $uri $uri/ /index.html;
38+
expires 1d;
39+
add_header Cache-Control "public";
1840
}
1941

2042
location /api {
2143
proxy_pass http://backend:5000;
22-
proxy_http_version 1.1;
23-
proxy_set_header Upgrade $http_upgrade;
24-
proxy_set_header Connection keep-alive;
2544
proxy_set_header Host $host;
26-
proxy_cache_bypass $http_upgrade;
45+
proxy_http_version 1.1;
2746
}
2847

2948
location /mcp {
3049
proxy_pass http://backend:5000;
31-
proxy_http_version 1.1;
32-
proxy_set_header Upgrade $http_upgrade;
33-
proxy_set_header Connection keep-alive;
3450
proxy_set_header Host $host;
35-
proxy_cache_bypass $http_upgrade;
51+
proxy_http_version 1.1;
3652
}
3753
}
3854
}

0 commit comments

Comments
 (0)