-
Notifications
You must be signed in to change notification settings - Fork 8
/
openresty.conf
70 lines (52 loc) · 2.3 KB
/
openresty.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /usr/local/var/log/nginx/error.log debug;
events {
worker_connections 1024;
}
http {
#include mime.types;
default_type application/octet-stream;
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=proxy-cache:50m;
#pass on http-headers as is to fix "upstream sent invalid chunked response" with some upstream servers
proxy_http_version 1.1;
proxy_set_header Connection "";
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
log_format upstreamlog '[$time_local] $status $upstream_cache_status $upstream_addr: $request';
server {
listen 8000;
server_name localhost;
#access_log logs/host.access.log main;
access_log /usr/local/var/log/nginx/access.log upstreamlog;
merge_slashes off;
resolver 8.8.8.8;
location ~ ^/proxy/(.*) {
proxy_pass $1?$args;
proxy_cache proxy-cache;
proxy_cache_use_stale error updating timeout;
proxy_cache_valid 200 302 404 24h; # The server cache expires after 24h - adjust as required.
proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
# CORS
#add_header 'Access-Control-Allow-Origin' "$http_origin";
more_set_headers 'Access-Control-Allow-Origin: $http_origin';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Expose-Headers' 'Accept-Ranges, Content-Encoding, Content-Length, Content-Range';
}
location / {
root /Users/maurobieg/code/master-thesis/code;
index index.html index.htm;
}
}
}