75 lines
1.8 KiB
Plaintext
75 lines
1.8 KiB
Plaintext
# This is an nginx config suitable for heroku.
|
|
# See client/nginx.conf for a more general starting point.
|
|
|
|
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_static on;
|
|
gzip_comp_level 2;
|
|
gzip_min_length 64;
|
|
|
|
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' %>;
|
|
|
|
types {
|
|
application/manifest+json webmanifest;
|
|
}
|
|
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/client/dist";
|
|
|
|
location /api {
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_pass http://app_server;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
}
|
|
|
|
location /assets {
|
|
expires 365d;
|
|
}
|
|
|
|
location ~ ^/games/(.*)/?$ {
|
|
try_files "" /index.html;
|
|
}
|
|
|
|
location = /cast {
|
|
try_files "" /cast.html;
|
|
}
|
|
|
|
location = / {
|
|
try_files "" /index.html;
|
|
}
|
|
|
|
error_page 404 /;
|
|
}
|
|
}
|