Blame view

Yi.Vben5.Vue3/scripts/deploy/nginx.conf 1.63 KB
515fceeb   “wangming”   框架初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  
  #user  nobody;
  worker_processes 1;
  
  #error_log  logs/error.log;
  #error_log  logs/error.log  notice;
  #error_log  logs/error.log  info;
  
  #pid        logs/nginx.pid;
  
  
  events {
    worker_connections 1024;
  }
  
  
  http {
    include mime.types;
    default_type application/octet-stream;
  
    types {
      application/javascript  js mjs;
      text/css                css;
      text/html               html;
    }
  
    sendfile on;
    # tcp_nopush     on;
  
    #keepalive_timeout  0;
    # keepalive_timeout 65;
  
    # gzip on;
    # gzip_buffers 32 16k;
    # gzip_comp_level 6;
    # gzip_min_length 1k;
    # gzip_static on;
    # gzip_types text/plain
    #   text/css
    #   application/javascript
    #   application/json
    #   application/x-javascript
    #   text/xml
    #   application/xml
    #   application/xml+rss
    #   text/javascript; #设置压缩的文件类型
    # gzip_vary on;
  
    server {
      listen 8080;
      server_name localhost;
  
      location / {
        root /usr/share/nginx/html;
        try_files $uri $uri/ /index.html;
        index index.html;
        # Enable CORS
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
        if ($request_method = 'OPTIONS') {
          add_header 'Access-Control-Max-Age' 1728000;
          add_header 'Content-Type' 'text/plain charset=UTF-8';
          add_header 'Content-Length' 0;
          return 204;
        }
      }
  
      error_page 500 502 503 504 /50x.html;
  
      location = /50x.html {
          root /usr/share/nginx/html;
      }
    }
  }