balibabu commited on
Commit
440a37a
·
1 Parent(s): 6a6f6eb

feat: add nginx.conf (#80)

Browse files

* feat: add nginx.conf

* feat: modify the root path of the web

Files changed (2) hide show
  1. docker/nginx.conf +46 -0
  2. web/.umirc.ts +1 -1
docker/nginx.conf ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ upstream api_service {
2
+ server 127.0.0.1:9380;
3
+ keepalive 2000;
4
+ }
5
+
6
+ server {
7
+ listen 5101;
8
+ # server_name xxx.com;
9
+
10
+ # gzip config
11
+ gzip on;
12
+ gzip_min_length 1k;
13
+ gzip_comp_level 9;
14
+ gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
15
+ gzip_vary on;
16
+ gzip_disable "MSIE [1-6]\.";
17
+
18
+
19
+ # remove api server header
20
+ proxy_hide_header Access-Control-Allow-Origin;
21
+ proxy_hide_header Access-Control-Allow-Methods;
22
+ proxy_hide_header Access-Control-Allow-Headers;
23
+
24
+ root /ragflow/web/dist;
25
+
26
+ location / {
27
+ index index.html;
28
+ try_files $uri $uri/ /index.html;
29
+ }
30
+
31
+ # Cache-Control: max-age、Expires
32
+ location ~ ^/static/(css|js|media)/ {
33
+ expires 10y;
34
+ access_log off;
35
+ }
36
+
37
+ # api proxy
38
+ location ^~/v1 {
39
+ rewrite ^/v1/(.*)$ /$1 break;
40
+ proxy_pass http://api_service/;
41
+ proxy_set_header Host $http_host;
42
+ proxy_set_header Connection close;
43
+ proxy_set_header X-Real-IP $remote_addr;
44
+ proxy_set_header X-Forwarded-Server $host;
45
+ }
46
+ }
web/.umirc.ts CHANGED
@@ -7,7 +7,7 @@ export default defineConfig({
7
  npmClient: 'npm',
8
  base: '/',
9
  routes,
10
- publicPath: '/web/dist/',
11
  esbuildMinifyIIFE: true,
12
  icons: {},
13
  hash: true,
 
7
  npmClient: 'npm',
8
  base: '/',
9
  routes,
10
+ publicPath: '/',
11
  esbuildMinifyIIFE: true,
12
  icons: {},
13
  hash: true,