-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-nginx.dev.conf
51 lines (45 loc) · 1.3 KB
/
docker-nginx.dev.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
upstream SET_A_NAME {
server rails:3000;
}
server {
listen 4000;
client_max_body_size 4G;
keepalive_timeout 10;
error_page 500 502 504 /500.html;
error_page 503 @503;
server_name *.lvh.me;
root /app/public;
# send non-static file requests to the app server
location / {
try_files $uri @SET_A_NAME;
}
location @SET_A_NAME {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://SET_A_NAME;
access_log /app/log/nginx.access.log;
error_log /app/log/nginx.error.log;
}
# deny requests for files that should never be accessed
location ~ /\. {
deny all;
}
location ~* ^.+\.(rb|log)$ {
deny all;
}
#serve static (compiled) assets directly if they exist (for rails production)
location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
try_files $uri @SET_A_NAME;
access_log off;
gzip_static on; # to serve pre-gzipped version
expires max;
add_header Cache-Control public;
# Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
add_header Last-Modified "";
add_header ETag "";
break;
}
}