forked from fecgov/openFEC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
47 lines (41 loc) · 1.46 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
worker_processes 1;
daemon off;
error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log;
events { worker_connections 1024; }
http {
log_format cloudfoundry '$http_x_forwarded_for - $http_referer - $request_time [$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;
gzip on;
gzip_vary on;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript application/json text/xml text/css;
tcp_nopush on;
keepalive_timeout 30;
port_in_redirect off; # Ensure that redirects don't include the internal container PORT - <%= ENV["PORT"] %>
server {
listen <%= ENV["PORT"] %>;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
<% if File.exists?(auth_file = File.join(ENV["APP_ROOT"], "nginx/conf/.htpasswd")) %>
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file <%= auth_file %>; #For Basic Auth
<% end %>
<% if ENV["FORCE_HTTPS"] %>
if ($http_x_forwarded_proto = http) {
return 301 https://$host$request_uri;
}
<% end %>
}
location /static {
root <%= ENV["APP_ROOT"] %>;
}
location /docs/static {
alias <%= ENV["APP_ROOT"] %>/node_modules/swagger-ui/dist;
}
}
}