forked from codeforjapan/codeforelection_front
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
40 lines (33 loc) · 798 Bytes
/
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
# https://github.com/puma/puma/blob/master/docs/nginx.md
upstream app {
server unix:///codeforelection_front/tmp/sockets/puma.sock;
}
server {
listen 80;
server_name localhost; # TODO
keepalive_timeout 5;
# static files
root /codeforelection_front/public;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# static files
if (-f $request_filename) {
break;
}
if (-f $request_filename.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://app;
break;
}
}
location ~* \.(ico|css|gif|jpe?g|png|js)(\?[0-9]+)?$ {
expires max;
break;
}
}