50 lines
1.2 KiB
Plaintext
50 lines
1.2 KiB
Plaintext
daemon off;
|
|
# Heroku dynos have at least 4 cores.
|
|
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
|
|
|
|
events {
|
|
use epoll;
|
|
accept_mutex on;
|
|
worker_connections <%= ENV['NGINX_WORKER_CONNECTIONS'] || 1024 %>;
|
|
}
|
|
|
|
http {
|
|
gzip on;
|
|
gzip_comp_level 2;
|
|
gzip_min_length 512;
|
|
gzip_proxied any; # Heroku router sends Via header
|
|
|
|
server_tokens off;
|
|
|
|
log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id';
|
|
access_log <%= ENV['NGINX_ACCESS_LOG_PATH'] || 'logs/nginx/access.log' %> l2met;
|
|
error_log <%= ENV['NGINX_ERROR_LOG_PATH'] || 'logs/nginx/error.log' %>;
|
|
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
sendfile on;
|
|
|
|
# Must read the body in 5 seconds.
|
|
client_body_timeout 5;
|
|
|
|
upstream app_server {
|
|
server unix:/tmp/nginx.socket fail_timeout=0;
|
|
}
|
|
|
|
server {
|
|
listen <%= ENV["PORT"] %>;
|
|
server_name _;
|
|
keepalive_timeout 5;
|
|
root /app/dist;
|
|
|
|
location = /index.html {
|
|
add_header Cache-Control "no-store, no-cache";
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
|
|
location / {
|
|
add_header 'Cache-Control' "public, max-age=3600";
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
} |