-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathnginx.conf
48 lines (43 loc) · 2.07 KB
/
nginx.conf
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
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
}
http {
server {
listen 8080;
server_name localhost;
include /usr/local/etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
access_log nginx-access.log;
error_log nginx-error.log;
location / {
root /path/to/repo/db;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, HEAD' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Accept-Ranges' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range,Accept-Ranges,Access-Control-Allow-Origin,Content-Encoding' always;
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, HEAD' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Accept-Ranges' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range,Accept-Ranges,Access-Control-Allow-Origin,Content-Encoding' always;
}
if ($request_method = 'HEAD') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, HEAD' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Accept-Ranges' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range,Accept-Ranges,Access-Control-Allow-Origin,Content-Encoding' always;
}
}
}
disable_symlinks off;
}