support/nginx-default.conf
map $http_x_forwarded_proto $fe_https {
default off;
https on;
}
map $host $is_localhost {
default off;
localhost on;
}
# log format
log_format custom '$remote_addr - $http_host $remote_user $request $request_body_file $request_length $request_completion $status $body_bytes_sent "$http_referrer" "$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time $server_name';
log_format json_custom escape=json '{ "time_local": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"host": "$host", '
'"request": "$request", '
'"request_length": "$request_length", '
'"status": "$status", '
'"body_bytes_sent": "$body_bytes_sent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"request_time": "$request_time", '
'"http_referrer": "$http_referer", '
'"http_user_agent": "$http_user_agent" }';
server {
set $301_redirect off;
listen 80 default_server;
access_log /var/log/nginx/access.log json_custom;
if ($fe_https = 'off') {
set $301_redirect on;
}
if ($is_localhost = 'on') {
set $301_redirect off;
}
if ($301_redirect = 'on') {
return 301 https://$host$request_uri;
}
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
location / {
root /augur/build;
}
}