IL-2602
/
nginx.conf
59 строк · 1.7 Кб
1server {
2
3listen 3263;
4server_name localhost;
5access_log /var/log/nginx/host.access.log;
6error_log /var/log/nginx/host.error.log;
7
8root /usr/share/nginx/html;
9index index.html index.htm;
10
11location ~ .*remoteEntry.js$ {
12expires -1;
13add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
14}
15
16location ~* \.(?:manifest|appcache|html?|xml|json)$ {
17expires -1;
18}
19
20location ~* \.(?:css|js)$ {
21try_files $uri =404;
22expires 1y;
23access_log off;
24add_header Cache-Control "public";
25}
26
27# Any route containing a file extension (e.g. /devicesfile.js)
28location ~ ^.+\..+$ {
29try_files $uri =404;
30}
31
32location / {
33root /usr/share/nginx/html;
34index index.html;
35autoindex on;
36set $fallback_file /index.html;
37if ($http_accept !~ text/html) {
38set $fallback_file /null;
39}
40# if ($uri ~ /$) {
41# set $fallback_file /null;
42# }
43try_files $uri $fallback_file;
44
45if ($request_method = 'OPTIONS') {
46add_header 'Access-Control-Allow-Origin: $http_origin');
47add_header 'Access-Control-Allow-Origin: GET, POST, DELETE, PUT, PATCH, OPTIONS');
48add_header 'Access-Control-Allow-Credentials: true');
49add_header 'Vary: Origin');
50
51}
52
53add_header 'Access-Control-Allow-Origin' "$http_origin" always;
54add_header 'Access-Control-Allow-Credentials' 'true' always;
55add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always;
56add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
57
58}
59}
60