-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
50 lines (42 loc) · 1.39 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
49
50
worker_processes 1;
daemon off;
error_log stderr;
events { worker_connections 1024; }
http {
log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
access_log /dev/stdout cloudfoundry;
default_type application/octet-stream;
include mime.types;
sendfile on;
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;
tcp_nopush on;
keepalive_timeout 300;
proxy_connect_timeout 300;
proxy_read_timeout 300;
# Ensure that redirects don't include the internal container PORT - {{port}}
port_in_redirect off;
server_tokens off;
server {
listen {{port}};
server_name localhost;
# Restrict IPs
include blockips.conf;
location ~ / {
resolver 8.8.8.8 ipv6=off valid=1s;
set $backend "{{env "CDN_ROUTE"}}";
proxy_pass $backend;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Script-Name "/";
proxy_set_header X-Forwarded-Proto https;
add_header Cache-Control "max-age=600";
rewrite ^/(.*)$ https://{{env "CDN_ROUTE"}}/$1 redirect;
}
}
}