-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
39 lines (32 loc) · 1 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
worker_processes 1;
daemon off;
error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log;
events { worker_connections 1024; }
http {
charset utf-8;
log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
access_log <%= ENV["APP_ROOT"] %>/nginx/logs/access.log cloudfoundry;
default_type application/octet-stream;
include mime.types;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
port_in_redirect off; # Ensure that redirects don't include the internal container PORT - <%= ENV["PORT"] %>
server_tokens off;
server {
listen <%= ENV["PORT"] %>;
server_name localhost;
<% if ENV["REDIRECT_URL"] %>
location / {
rewrite "^/[0-9]{4}/[0-9]{2}/[0-9]{2}/(.*)$" <%= ENV["REDIRECT_URL"] %>/$1 ;
rewrite "^/(.*)$" <%= ENV["REDIRECT_URL"] %>/$1 ;
}
<% else %>
error_page 404 /index.html;
location / {
root <%= ENV["APP_ROOT"] %>/public;
try_files $uri /index.html;
}
<% end %>
}
}