xingyu
2023-11-23 4305f58d201382c71f41fcd2625bc45ae09a2ae0
提交 | 用户 | age
c659c1 1 #user  nobody;
248f9d 2 worker_processes 1;
c659c1 3
4 #error_log  logs/error.log;
5 #error_log  logs/error.log  notice;
6 #error_log  logs/error.log  info;
7
8 #pid        logs/nginx.pid;
9 events {
248f9d 10     worker_connections 1024;
c659c1 11 }
12
13
14 http {
248f9d 15     include mime.types;
S 16     default_type application/octet-stream;
c659c1 17     server {
248f9d 18         listen 80;
S 19         location / {
20             root /usr/share/nginx/html/dist;
21             try_files $uri $uri/ /index.html;
22             index index.html;
23             # Enable CORS
24             add_header 'Access-Control-Allow-Origin' '*';
25             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
26             add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
27             if ($request_method = 'OPTIONS') {
28                 add_header 'Access-Control-Max-Age' 1728000;
29                 add_header 'Content-Type' 'text/plain charset=UTF-8';
30                 add_header 'Content-Length' 0;
31                 return 204;
32             }
556575 33             if ($request_filename ~* ^.*?.(html|htm|js)$) {
34               add_header Cache-Control no-cache;
35             }
c659c1 36         }
248f9d 37     }
c659c1 38 }